Page 1 of 2

Assigning Custom Template to Menu Items Does Not Work

Posted: Fri Nov 04, 2011 11:07 pm
by chriscadcw
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

Re: Assigning Custom Template to Menu Items Does Not Work

Posted: Fri Nov 04, 2011 11:25 pm
by chriscadcw
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.

Re: Assigning Custom Template to Menu Items Does Not Work

Posted: Sun Nov 06, 2011 5:07 am
by aaanativearts
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.

Re: Assigning Custom Template to Menu Items Does Not Work

Posted: Sun Nov 06, 2011 7:06 am
by aaanativearts

Re: Assigning Custom Template to Menu Items Does Not Work

Posted: Mon Nov 07, 2011 9:45 am
by manearaluca
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.

Re: Assigning Custom Template to Menu Items Does Not Work

Posted: Wed Nov 30, 2011 5:32 pm
by randy270
THAT WORKED!!! Thanks so much!

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

Re: Assigning Custom Template to Menu Items Does Not Work

Posted: Fri Feb 17, 2012 2:58 am
by dex
Thanks manearaluca
It worked for me too! I am using J 2.5.1
Dex

Re: Assigning Custom Template to Menu Items Does Not Work

Posted: Fri Feb 17, 2012 3:10 am
by Webdongle
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.

Re: Assigning Custom Template to Menu Items Does Not Work

Posted: Wed Feb 29, 2012 3:31 pm
by manearaluca
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.

Re: Assigning Custom Template to Menu Items Does Not Work

Posted: Wed Feb 29, 2012 3:45 pm
by Webdongle
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

Re: Assigning Custom Template to Menu Items Does Not Work

Posted: Wed Feb 29, 2012 4:10 pm
by manearaluca
Yes, thank you so much.
I understand now.

Re: Assigning Custom Template to Menu Items Does Not Work

Posted: Fri May 11, 2012 6:17 am
by ollieo
Perfect worked for me too, Awesome thanks for the help.

Re: Assigning Custom Template to Menu Items Does Not Work

Posted: Sat May 12, 2012 8:58 am
by fonitsua
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.

Re: Assigning Custom Template to Menu Items Does Not Work

Posted: Fri Jun 29, 2012 1:03 am
by brentonking
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?

Re: Assigning Custom Template to Menu Items Does Not Work

Posted: Fri Jul 27, 2012 5:00 pm
by jkwebdesign
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.

Re: Assigning Custom Template to Menu Items Does Not Work

Posted: Fri Jul 27, 2012 5:14 pm
by jkwebdesign
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!

Re: Assigning Custom Template to Menu Items Does Not Work

Posted: Thu Aug 16, 2012 6:38 pm
by glennt
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 :'(

Re: Assigning Custom Template to Menu Items Does Not Work

Posted: Mon Oct 15, 2012 6:25 am
by jkwebdesign
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

Re: Assigning Custom Template to Menu Items Does Not Work

Posted: Mon Oct 15, 2012 1:38 pm
by glennt
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

Re: Assigning Custom Template to Menu Items Does Not Work

Posted: Mon Oct 15, 2012 4:14 pm
by jkwebdesign
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.

Re: Assigning Custom Template to Menu Items Does Not Work

Posted: Fri Oct 19, 2012 6:20 am
by twizzlermambo
Hey jkwebdesign,

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

Re: Assigning Custom Template to Menu Items Does Not Work

Posted: Fri Oct 19, 2012 6:44 am
by jkwebdesign
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/

Re: Assigning Custom Template to Menu Items Does Not Work

Posted: Fri Oct 19, 2012 2:56 pm
by twizzlermambo
Downloaded, installed and immediately I was able to assign templates correctly. Thanks for pointing me there!

Re: Assigning Custom Template to Menu Items Does Not Work

Posted: Thu Mar 07, 2013 11:01 am
by Mellish
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

Re: Assigning Custom Template to Menu Items Does Not Work

Posted: Thu Mar 07, 2013 11:16 am
by Mellish
Reinstalled Joomla and now it works... must be some bugs somewhere...

Re: Assigning Custom Template to Menu Items Does Not Work

Posted: Mon May 13, 2013 10:22 am
by DavidTorrens
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?

Re: Assigning Custom Template to Menu Items Does Not Work

Posted: Fri Sep 06, 2013 8:42 pm
by tamergowayed
That Worked!!! :laugh: :laugh: Thanks so much! (y)

Re: Assigning Custom Template to Menu Items Does Not Work

Posted: Fri Sep 06, 2013 9:25 pm
by DavidTorrens
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. :-\

Re: Assigning Custom Template to Menu Items Does Not Work

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

Re: Assigning Custom Template to Menu Items Does Not Work

Posted: Wed Aug 13, 2014 3:27 pm
by TinaLiu
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!!! :)