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.

 

Assign template to Sectionblog page, another to the single article

Assign template to Sectionblog page, another to the single article

Hi
I need to assign a template to some of the sectionblog pages of my site and another one to the relative articles.
At this moment if I assign a template to the menu item linked to the blogsection pages, the articles get the same template too (not the default one).
Is this possible with your component? it is very diffucult for me to understand how it works.

theant
Beginner Modder
ranks
useravatar
Offline
3 Posts
Administrator has disabled public posting

Re: Assign template to Sectionblog page, another to the single article

Hi theant,

this is pretty simple to achieve with MetaTemplate.

TECHNIQUE 1: All in the same MetaTemplate rule:

Create a MetaTemplate rule and use the following recipe in the Advanced PHP box:

if ($option == "com_content" and $view == "article") return "TEMPLATENAME1";
if ($option == "com_content" and ( $view == "section" or $view == "category") ) return "TEMPLATENAME2";


TECHNIQUE 2: Use 2 separate rules, one that detects articles and one that detects sections/categories:

a - set up the 1st rule
b - enter this into the Advanced PHP box:

if ($option == "com_content" and $view == "article") return true;

c - Then in the SUCCEED action, use the drop-down to select the template to be used for articles.

d - save that rule and create a second rule

e - use the following PHP in the second rule:

if ($option == "com_content" and ( $view == "section" or $view == "category") ) return true;

f - Then in the SUCCEED action, use the drop-down to select the template to be used for categories/sections.

g - save the rule and test it out.


Done.

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: Assign template to Sectionblog page, another to the single article

Thanks a lot, the second one works fine.
How to set just for Section 1, Section 2, Sction 3 and Category 1, Category 2?

theant
Beginner Modder
ranks
useravatar
Offline
3 Posts
Administrator has disabled public posting

Re: Assign template to Sectionblog page, another to the single article

In that case, I'd change the second rule to this:

if ($option == "com_content" and $view == "section" and $id == 1 ) return true;
if ($option == "com_content" and $view == "section" and $id == 2 ) return true;
if ($option == "com_content" and $view == "section" and $id == 3 ) return true;
if ($option == "com_content" and $view == "category" and $id == 1 ) return true;
if ($option == "com_content" and $view == "category" and $id == 2 ) return true;

There are more elegant ways to express this in PHP, but it's probably easier to understand in this form.

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: Assign template to Sectionblog page, another to the single article

Thank you.

theant
Beginner Modder
ranks
useravatar
Offline
3 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:
368

Online: 
bseba9l

Forum Legend:

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