Page 2 of 2

Re: Assigning Custom Template to Menu Items Does Not Work

Posted: Wed Aug 13, 2014 3:46 pm
by TinaLiu
almissh wrote:manearaluca thank you very much!
I spent a lot of time to solve this problem!

In Joomla! 3.3.0 the file "root/includes/application.php" doesn't exist anymore. you can find it in "root/libraries/cms/application/site.php" and inside it, there is a getTemplate() function that you can modify adding $this->route();

I hope it can help someone
bye

Hello,
I am so new to this, how do you get to the root file? Thank you for your time!

Re: Assigning Custom Template to Menu Items Does Not Work

Posted: Wed Aug 13, 2014 3:58 pm
by almissh
root stands for the root of your joomla site.
if www.mywebsite.com is your site, www.mywebsite.com is your root. In this folder there are many folders: "administrator", "bin", "cache", "cli" ecc... you can find the folder "libraries" and following "www.mywebsite.com/libraries/cms/application/site.php" you can find site.php.

bye

Re: Assigning Custom Template to Menu Items Does Not Work

Posted: Fri May 26, 2017 10:07 am
by DogMatix
I required SEF URL’s and multiple templates. I can’t believe this post dates back to 2011 and a permanent fix is not in place. Anyway, the fix for me (Joomla 3.7.2) was editing /libraries/cms/application/site.php

I searched for ‘Get the id of the active menu item’ then applied pretty much the exact same fix as @maneraluca did in Post 5:

Code: Select all

		// Get the id of the active menu item
		$menu = $this->getMenu();
		$item = $menu->getActive();

		if (!$item)
		{
			// NEW CODE
			$this->route();
			//END NEW CODE

			$item = $menu->getItem($this->input->getInt('Itemid', null));
		}
		

Re: Assigning Custom Template to Menu Items Does Not Work

Posted: Sat Dec 08, 2018 2:29 am
by cereza
Hi there,
In Joomla 3.9.1 /libraries/cms/application/site.php doesn't exist.
I just applied the change by maneraluca in /libraries/src/Application/SiteApplication.php

// Get the id of the active menu item
$menu = $this->getMenu();
$item = $menu->getActive();

if (!$item)
{
// NEW CODE
$this->route();
//END NEW CODE

$item = $menu->getItem($this->input->getInt('Itemid', null));
}

It worked.