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.
chriscadcw
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Thu Apr 07, 2011 3:12 pm

Assigning Custom Template to Menu Items Does Not Work

Post by chriscadcw » Fri Nov 04, 2011 11:07 pm

I have a website that I am setting up for designing custom templates for clients using Joomla 1.7. I would like to be able to have multiple custom templates loaded and have them applied when a client has logged in and clicks a menu link that is specific to their user access group. I currently have 2 templates installed, and both work independently if set as the default template. However I can not get it to switch templates to anything other than the default template. I'm not sure if this is a bug or if I am simply missing a step in the process.

Here is how my current configuration is set up:

Default Template - Beez20
Custom Template - tmp_name (changed for confidentiality reasons)

Default Template Menu Assignments -
Home

Custom Template Menu Assignments -
Client Link ( From Home Menu )
All Links on client specific menu

I have verified both from the Menu Module and from the Template manager that the assigned template for the the Client Link is set to the custom template, however, when they click the link it still applies the Beez20 template.

Is there somewhere else that I need to look to make the template assignments work?

Any help would be greatly appreciated as right now I have to do a completely separate Joomla! installation for each custom template that I am designing and that is getting very, very tiresome.

Thanks
Last edited by toivo on Sat Dec 08, 2018 8:20 am, edited 2 times in total.
Reason: mod note: locked topic as requested

chriscadcw
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Thu Apr 07, 2011 3:12 pm

Re: Assigning Custom Template to Menu Items Does Not Work

Post by chriscadcw » Fri Nov 04, 2011 11:25 pm

I did find a "psudo" solution to this issue so I thought I'd post and reply to my own question.

It appears that the issue resides in the SEF/SEO setting. If you go to your "Global Configuration" and turn off SEF the template changes are then applied.

I hope that there will be a fix at some point that will allow for the use of SEF and still have multiple templates.

For now I will just turn it off on my development site to allow me to display more than one custom template.

Hope this helps someone else who is struggling with this issue.

aaanativearts
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 203
Joined: Fri Aug 04, 2006 12:38 pm

Re: Assigning Custom Template to Menu Items Does Not Work

Post by aaanativearts » Sun Nov 06, 2011 5:07 am

It's not working for me either. Both templates are there in the template interface, and the 2nd template is assigned to the contact form. The 2nd template was discovered and installed successfully. But the contact form still shows the default template. Turning off SEF urls is not an option if you care about SEO.

aaanativearts
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 203
Joined: Fri Aug 04, 2006 12:38 pm

Re: Assigning Custom Template to Menu Items Does Not Work

Post by aaanativearts » Sun Nov 06, 2011 7:06 am


manearaluca
Joomla! Apprentice
Joomla! Apprentice
Posts: 38
Joined: Wed Jun 24, 2009 6:51 am

Re: Assigning Custom Template to Menu Items Does Not Work

Post by manearaluca » Mon Nov 07, 2011 9:45 am

Hi Guys,

I found a solution for shwiching templates when SEF is active.

Inside root/includes/application.php
search for this line: public function getTemplate($params = false)

Inside that function I added a single line code:

Code: Select all

// Get the id of the active menu item
		$menu = $this->getMenu();
		$item = $menu->getActive();
		if (!$item) {
			//added here  here the new line by Raluca Manea
			$this->route();
			//END CODE CHANGED added here  here the new line by Raluca Manea		
				
			$item = $menu->getItem(JRequest::getInt('Itemid'));
		}
This is the line added by me:

Code: Select all

$this->route();
Hope this help you.

Byee.

randy270
Joomla! Intern
Joomla! Intern
Posts: 67
Joined: Thu May 22, 2008 1:40 pm
Location: Philadelphia, PA
Contact:

Re: Assigning Custom Template to Menu Items Does Not Work

Post by randy270 » Wed Nov 30, 2011 5:32 pm

THAT WORKED!!! Thanks so much!

Now, I have to remember to fix this again after the next upgrade. :(

User avatar
dex
Joomla! Explorer
Joomla! Explorer
Posts: 351
Joined: Tue Oct 18, 2005 9:44 pm
Location: Sydney - Australia
Contact:

Re: Assigning Custom Template to Menu Items Does Not Work

Post by dex » Fri Feb 17, 2012 2:58 am

Thanks manearaluca
It worked for me too! I am using J 2.5.1
Dex
Dex
Joomla implementor
http://www.spikesystems.com.au
http://www.joomla.org.au - Aussie Joomla user groups & events

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 37022
Joined: Sat Apr 05, 2008 9:58 pm

Re: Assigning Custom Template to Menu Items Does Not Work

Post by Webdongle » Fri Feb 17, 2012 3:10 am

chriscadcw wrote:...
Here is how my current configuration is set up:

Default Template - Beez20
Custom Template - tmp_name (changed for confidentiality reasons)

Default Template Menu Assignments -
Home

Custom Template Menu Assignments -
Client Link ( From Home Menu )
All Links on client specific menu
...
The default Template does not need to be assigned to a menu item. If you want one Template for Home and another for the other menu items.
Example:
You want Template 'A' for the Home menu item and Template 'B' for the rest of the site. So ...
Template 'B' as default no assignment because it will show on all except menu items assigned to another Template.
Template 'A' assigned to to the Home page.
That way you avoid conflicts and do not need to edit any code.
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"The definition of insanity is doing the same thing over and over again, but expecting different results": Albert Einstein

manearaluca
Joomla! Apprentice
Joomla! Apprentice
Posts: 38
Joined: Wed Jun 24, 2009 6:51 am

Re: Assigning Custom Template to Menu Items Does Not Work

Post by manearaluca » Wed Feb 29, 2012 3:31 pm

The solution I gave above works. But I found another problem which I can't handle it.

I installed two T3 framework templates (more precisely, two templates from http://www.joomlart.com), but with SEF activated, it generates different html page and ruin the entire design.

Do you know what could be wrong?

Thank you,

Raluca.

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 37022
Joined: Sat Apr 05, 2008 9:58 pm

Re: Assigning Custom Template to Menu Items Does Not Work

Post by Webdongle » Wed Feb 29, 2012 3:45 pm

manearaluca wrote:The solution I gave above works. But I found another problem which I can't handle it.
Obviously your solution caused more problems than it solved.
manearaluca wrote:...
Do you know what could be wrong?
...
Yes, ... you edited a core file instead of correctly using the settings in Joomla admin. Please re read my example http://forum.joomla.org/posting.php?mod ... &p=2756092
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"The definition of insanity is doing the same thing over and over again, but expecting different results": Albert Einstein

manearaluca
Joomla! Apprentice
Joomla! Apprentice
Posts: 38
Joined: Wed Jun 24, 2009 6:51 am

Re: Assigning Custom Template to Menu Items Does Not Work

Post by manearaluca » Wed Feb 29, 2012 4:10 pm

Yes, thank you so much.
I understand now.

ollieo
Joomla! Apprentice
Joomla! Apprentice
Posts: 25
Joined: Fri May 13, 2011 8:05 am
Location: Sydney, Australia
Contact:

Re: Assigning Custom Template to Menu Items Does Not Work

Post by ollieo » Fri May 11, 2012 6:17 am

Perfect worked for me too, Awesome thanks for the help.

fonitsua
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Sat Aug 22, 2009 10:44 am

Re: Assigning Custom Template to Menu Items Does Not Work

Post by fonitsua » Sat May 12, 2012 8:58 am

thanks manearaluca!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
i spent almost a day trying to fix it until i stumble on your solution (5 minutes -- done!!!). thank u, thank u, thank u.

Ben F.

brentonking
Joomla! Apprentice
Joomla! Apprentice
Posts: 24
Joined: Wed Jan 19, 2011 7:14 am

Re: Assigning Custom Template to Menu Items Does Not Work

Post by brentonking » Fri Jun 29, 2012 1:03 am

The Fix: $this->route();
has created issues with K2 Modules, Jom Social & jComments (Captcha) on my site, so I really suggest people avoid using it. Those are just the ones I have come across so far too.

My site was being staged on a local server first and then I moved it to a live site and I feel this might have something to do with the issue, did everyone else who have had this problem do the same thing?

User avatar
jkwebdesign
Joomla! Apprentice
Joomla! Apprentice
Posts: 26
Joined: Fri Apr 15, 2011 6:04 pm
Location: Varkaus, Finland
Contact:

Re: Assigning Custom Template to Menu Items Does Not Work

Post by jkwebdesign » Fri Jul 27, 2012 5:00 pm

What the hell could cause this? Im working on a site maded with 2.5.6 and have same problem. I have done many sites with multiple templates and this is first time when this occurs.

And intresting thing is that first this was working and it suddenly stopped. I know i have configured it right so that is not a problem. And it is working when SEF is off. I also tried it with 3rd party sef components but it is broken with those too. I´m not sure what i was doing when it stopped working but i know that only thing related to menus or templates was one edit in menu manager: I changed menu type from one contact to breezing forms form. That menu item was on default template so it isn´t even related to that menu item using other template.

I have looked db and i can´t see anything broken there.. Template association id looks also correct.

Templates i use are maded with Artisteer but that isn´t a problem because default templates arn´t working either. And this was also working before.

I was planning to announce my new site tomorrow but im not sure anymore because i really don´t like core hacs. I also tried this hack and it worked without any problems..

Any help would be nice and if someone talent wan´t to look my ste/db just take contact and i will send you info.
We offer first-rate and versatile Internet, marketing and graphic services..
http://www.jkwebdesign.fi/en/
http://www.facebook.com/jkwebdesignFI

User avatar
jkwebdesign
Joomla! Apprentice
Joomla! Apprentice
Posts: 26
Joined: Fri Apr 15, 2011 6:04 pm
Location: Varkaus, Finland
Contact:

Re: Assigning Custom Template to Menu Items Does Not Work

Post by jkwebdesign » Fri Jul 27, 2012 5:14 pm

Ok, hack isnt for me.. 40° Portfolio component doesn´t work when i applied that hack.. This is kind of day i hate a lot!
We offer first-rate and versatile Internet, marketing and graphic services..
http://www.jkwebdesign.fi/en/
http://www.facebook.com/jkwebdesignFI

glennt
Joomla! Apprentice
Joomla! Apprentice
Posts: 12
Joined: Wed Dec 22, 2010 6:30 pm

Re: Assigning Custom Template to Menu Items Does Not Work

Post by glennt » Thu Aug 16, 2012 6:38 pm

I am using the hack right now to get my site operating properly, the thought of losing the sef (my site has been up for a couple of years and there are links to many of the pages) is a horrible thought.

I have three problems with the hack in place, remove it and all three problems go away and my site looks broken because I am left with only one template.

Hard to believe that there seems to be no solution and no one seems to be worried about it. I would that thought everyone would be using this function and want SEF as well.

Any other ideas anyone? I am willing to pay for a solution.

G :'(

User avatar
jkwebdesign
Joomla! Apprentice
Joomla! Apprentice
Posts: 26
Joined: Fri Apr 15, 2011 6:04 pm
Location: Varkaus, Finland
Contact:

Re: Assigning Custom Template to Menu Items Does Not Work

Post by jkwebdesign » Mon Oct 15, 2012 6:25 am

Ok, now i have found out that my problem is related to Abivia Supertable plugin (http://extensions.joomla.org/extensions ... ists/18972). When i disable it, everything works ok. Everything is working with that plugin when sef is off so the problem occurs on when sef in on and that Supertable plugin is on.

I have reported this to developer of Supertable extension and he have also looked into this but have not found any fix. He thinks that this is Joomla related bug. Here is quote of his answer and link to that Forum topic:

"
So... I have a test case where the SEF URL ignores the template assignment, but the non-SEF URL works fine, at the same time, in the same install with both SEF and SuperTable enabled.

This means it's a Joomla problem, and it's probably not an easy one. SuperTable doesn't even run until long after this thing should have been decided -- honestly they're so unrelated I thought I could run a quick test and show that your problem had to be something else.

I'm going to look into it, but it might get hairy. Trying to see if I can get a few more Joomla devs to look at it too. Hopefully we can get to the bottom of it.
"

Source:
http://www.abivia.net/forum/11-supertab ... -in-jo#772
We offer first-rate and versatile Internet, marketing and graphic services..
http://www.jkwebdesign.fi/en/
http://www.facebook.com/jkwebdesignFI

glennt
Joomla! Apprentice
Joomla! Apprentice
Posts: 12
Joined: Wed Dec 22, 2010 6:30 pm

Re: Assigning Custom Template to Menu Items Does Not Work

Post by glennt » Mon Oct 15, 2012 1:38 pm

Wow

I just disabled supertable and it looks like problem solved.

I feel fantastic!!!

Thanks so much.

I wasn't even using supertable.

Woo HOo



G

User avatar
jkwebdesign
Joomla! Apprentice
Joomla! Apprentice
Posts: 26
Joined: Fri Apr 15, 2011 6:04 pm
Location: Varkaus, Finland
Contact:

Re: Assigning Custom Template to Menu Items Does Not Work

Post by jkwebdesign » Mon Oct 15, 2012 4:14 pm

Great that i could help. Maybe someone near Joomla can ficure out what is wrong? I have solved my problem by editing Supertable plugin (wich is awesom..) but it would always be better that i don´t need to use custom code.
We offer first-rate and versatile Internet, marketing and graphic services..
http://www.jkwebdesign.fi/en/
http://www.facebook.com/jkwebdesignFI

twizzlermambo
Joomla! Apprentice
Joomla! Apprentice
Posts: 24
Joined: Thu Dec 04, 2008 9:19 pm

Re: Assigning Custom Template to Menu Items Does Not Work

Post by twizzlermambo » Fri Oct 19, 2012 6:20 am

Hey jkwebdesign,

Would you mind sharing how you edited the Supertable plugin to fix this? I'm having the same problem!! :)

User avatar
jkwebdesign
Joomla! Apprentice
Joomla! Apprentice
Posts: 26
Joined: Fri Apr 15, 2011 6:04 pm
Location: Varkaus, Finland
Contact:

Re: Assigning Custom Template to Menu Items Does Not Work

Post by jkwebdesign » Fri Oct 19, 2012 6:44 am

twizzlermambo wrote:Hey jkwebdesign,

Would you mind sharing how you edited the Supertable plugin to fix this? I'm having the same problem!! :)
It was really bad hack but worked for me:) You don´t need to use that anymore because Developer of Supertable have updated his plugin yesterday and now that problem is fixed.

Problem is somehow related to Mootoold loading so if someone have problems and does not have Supertable installed, try to disable other plugins one in a time and test when it start to work correct. Please report here if you find some extension to cause problems and tell to extension developer that they could fix it.

Link to updated Supertable plugin:
http://www.abivia.net/downloads/joomla- ... oomla-2.5/
We offer first-rate and versatile Internet, marketing and graphic services..
http://www.jkwebdesign.fi/en/
http://www.facebook.com/jkwebdesignFI

twizzlermambo
Joomla! Apprentice
Joomla! Apprentice
Posts: 24
Joined: Thu Dec 04, 2008 9:19 pm

Re: Assigning Custom Template to Menu Items Does Not Work

Post by twizzlermambo » Fri Oct 19, 2012 2:56 pm

Downloaded, installed and immediately I was able to assign templates correctly. Thanks for pointing me there!

Mellish
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Thu Mar 07, 2013 10:41 am

Re: Assigning Custom Template to Menu Items Does Not Work

Post by Mellish » Thu Mar 07, 2013 11:01 am

Hi

I've got a new install of Joomla 2.5.9. Uploaded a template (which appears to have been downloaded thousands of times before) and I get the same problem when I assign the new template as 'default' - the 'assigned' green check stays against Beez5 and Beez5 is what shows on the home site, instead of the new template.

I wasn't sure from the posts below just what is the solution for this? One post suggests a reinstall, another a code fix. Could anyone tell me if there is a starightforward fix?

thanks

Mellish
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Thu Mar 07, 2013 10:41 am

Re: Assigning Custom Template to Menu Items Does Not Work

Post by Mellish » Thu Mar 07, 2013 11:16 am

Reinstalled Joomla and now it works... must be some bugs somewhere...

DavidTorrens
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Tue Apr 26, 2011 4:12 pm

Re: Assigning Custom Template to Menu Items Does Not Work

Post by DavidTorrens » Mon May 13, 2013 10:22 am

Now on Joomla 2.5.11 and template assignment with SEF/SEO has not worked since 2.5.9. I have tried the re-install and this did not have any effect.
Is there an update please on the checks/actions to take if only the default template appears when SEF is enabled and different templates have been asigned to different pages.
Has anyone cured this issue on 2.5.11?

tamergowayed
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Thu Sep 05, 2013 3:08 am

Re: Assigning Custom Template to Menu Items Does Not Work

Post by tamergowayed » Fri Sep 06, 2013 8:42 pm

That Worked!!! :laugh: :laugh: Thanks so much! (y)

DavidTorrens
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Tue Apr 26, 2011 4:12 pm

Re: Assigning Custom Template to Menu Items Does Not Work

Post by DavidTorrens » Fri Sep 06, 2013 9:25 pm

Just a query on the last post saying "That worked thanks"

I assume this is referring to a re-install working to clear the problem.

I had tried a re-install and it did not clear the problem with SEO. Has anyone any other suggestions for clearing this issue. :-\

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 » Thu Jul 03, 2014 2:48 pm

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

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:27 pm

chriscadcw wrote:I did find a "psudo" solution to this issue so I thought I'd post and reply to my own question.

It appears that the issue resides in the SEF/SEO setting. If you go to your "Global Configuration" and turn off SEF the template changes are then applied.

I hope that there will be a fix at some point that will allow for the use of SEF and still have multiple templates.

For now I will just turn it off on my development site to allow me to display more than one custom template.

Hope this helps someone else who is struggling with this issue.
IT WORKS FOR ME!!! THANK YOU SOOOOO VERY MUCH!!! :)


Locked

Return to “Templates for Joomla! 2.5”