Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
- Index
- » Chameleon / ChameleonLite
- » ChameleonLite
- » different templates for single category
different templates for single category
different templates for single category
I am trying to make a mobile site for my main website using meta template. I created a menu and named it as "mobile". So my mobile site url becomes www.mydomain.com/mobile. I assigned a category (sports) to that "mobile" menu. Hence now my mobile site showing only sports articles from my main website. I assigned a different template to "mobile" menu/site. Now mobile site showing articles (blog view) with new template. But when I click on "read more" (full story)link it goes again to old template (main template). My requirement is full story will open on the same template (mobile template). Is it possible using by Meta template?.
06-Jun-11 11:41:05
Re: different templates for single category
Hi prince.gen,
yes, you can definitely do this.
I guess that the main criteria is for these articles, that ALL articles within the Sports category should use the new template.
So I would make a rule in MetaTemplate like this:
if ($content_genius->check("category_title = sports")) return true;
Then in the SUCCEED action, set the template to be used for these articles. In fact, the rule will catch not only the articles in the sports category, but also the category page itself. I guess that that's what you intend.
Hope that helps,
Stephen
Re: different templates for single category
Thanks for reply. If I apply that rule, it will change in both main site and mobile site. But I need that in main site sports articles display in old template (main template) and in mobile site sports article display in new template (mobile template).
structure is like this
sports category > main site > main template
sports category > mobile site > mobile template
Re: different templates for single category
Ok, that's a bit more complicated.
Can I ask, how are your URLs set up? Can you give an example of the URL for when an article is shown in the mobile site, and when the same article is shown in the main site?
I have a feeling that the URL might be the same in both cases... and that makes things complicated.
Cheers,
Stephen
Re: different templates for single category
yes you are right. same url. because mobile site shows the same article from sports category.
the following url's are main url's - category blog
http://mydomain.com/sports
http://mydomain.com/mobile
Can i apply a template for only menu not for category or section?
Re: different templates for single category
The question is - can you give me the URLs of an example article beneath those URLs?
i.e. what URL do you get when you click on one of the articles listed in mydomain.com/mobile? Is it the same as the URL when you click on one of the articles in mydomain.com/sports?
Cheers,
Stephen
Re: different templates for single category
main site : http://mydomain.com/sports/72Nadal-boun … okyo-.html
mobile site : http://mydomain.com/sports/72Nadal-boun … okyo-.html
Re: different templates for single category
Mmm, that's a really hard one. As long as the URLs for the articles are exactly the same, I don't think there's any good solution basing the template purely on the menu.
Let's try to think about it a different way.
Ideas:
(1) Instead of making a separate menu in order to trigger the template, why not just detect whether someone is using a mobile device, and trigger the different template that way? This means that everyone sees the same menu (Sports), but when they are inside it, the template adjusts to their device?
(2) Alternatively, you could make some links on your page that toggle the template to the mobile template and back again.
e.g. make 2 links in your menu: one to "mysite.com/?mobile=1" and one to "mysite.com/?mobile=2". The first one will switch on the mobile template, and the second will switch back to the normal template.
To do (2), in MetaMod, make the following rules:
1:
if (JRequest::getVar("mobile") == 1) return true;
SUCCEED action: reset session variable "A"; continue to next rule
FAIL action: continue to next rule
2:
if (JRequest::getVar("mobile") == 2) return true;
SUCCEED action: set session variable "A"; continue to next rule
FAIL action: continue to next rule
3:
use the "detect session variable A" dropdown as the condition.
SUCCEED action: set the mobile template, remove the "mobile template" menu item
FAIL action: remove the "back to normal template" menu item.
Hope that helps,
Stephen
- Index
- » Chameleon / ChameleonLite
- » ChameleonLite
- » different templates for single category
Board Info
- Board Stats:
- Total Topics:
- 1689
- Total Polls:
- 6
- Total Posts:
- 5942
- Total Posts Today:
- 1
- User Info:
- Total Users:
- 7623
- Newest User:
- laptopreviews21
- Members Online:
- 0
- Guests Online:
- 122
- Online:
- There are no members online
Forum Legend:
Topic
New
Locked
Sticky
Active
New/Active
New/Locked
New Sticky
Locked/Active
Active/Sticky
Sticky/Locked
Sticky/Active/Locked