Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

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?.

Edited By: prince.gen
06-Jun-11 11:41:05

prince.gen
Beginner Modder
ranks
useravatar
Offline
10 Posts
Administrator has disabled public posting

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

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3329 Posts
User info in posts
Administrator has disabled public posting

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

prince.gen
Beginner Modder
ranks
useravatar
Offline
10 Posts
Administrator has disabled public posting

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

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3329 Posts
User info in posts
Administrator has disabled public posting

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?

prince.gen
Beginner Modder
ranks
useravatar
Offline
10 Posts
Administrator has disabled public posting

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

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3329 Posts
User info in posts
Administrator has disabled public posting

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

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3329 Posts
User info in posts
Administrator has disabled public posting

Re: different templates for single category

I found a solution. I wish to share to others also. Using "virtual Domain" component, I could achieve my goal. Thank you so much.

prince.gen
Beginner Modder
ranks
useravatar
Offline
10 Posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1698
Total Polls:
6
Total Posts:
5945
Total Posts Today:
1
User Info:
 
Total Users:
5610
Newest User:
idim4
Members Online:
1
Guests Online:
378

Online: 
bseba9l

Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked