Assigning Custom Template to Menu Items Does Not Work

Everything to do with Joomla! 2.5 templates and templating.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
TinaLiu
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Mon Jun 16, 2014 4:14 pm

Re: Assigning Custom Template to Menu Items Does Not Work

Post by TinaLiu » Wed Aug 13, 2014 3:46 pm

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!

almissh
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Thu Jul 03, 2014 2:39 pm

Re: Assigning Custom Template to Menu Items Does Not Work

Post by almissh » Wed Aug 13, 2014 3:58 pm

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

DogMatix
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Wed Apr 19, 2017 4:13 pm

Re: Assigning Custom Template to Menu Items Does Not Work

Post by DogMatix » Fri May 26, 2017 10:07 am

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));
		}
		

cereza
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Tue Sep 09, 2008 8:02 am

Re: Assigning Custom Template to Menu Items Does Not Work

Post by cereza » Sat Dec 08, 2018 2:29 am

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.


Locked

Return to “Templates for Joomla! 2.5”