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.

 

changing/targeting specific area of template

changing/targeting specific area of template

Hi
I've got a noob question regarding chamelon (great joomla extension by the way). I would like the website I'm designing to use several slight variations of the main template.

My questions are-
I want the header, footer and navigation to stay the same it's only the content that appears in the main body (joomla component section) that will change. Can this be achieved using Chameleon or do I need to create a new complete template for each article.

I don't really want to have to create lots of templates that are basically the same (if that makes sense). It's only really a specific area of the template that I want to target and change for different articles.

Any advice would be very welcome, thanks.
Dan

P.S. Apologies if this is a silly question.

trailofdan
Beginner Modder
ranks
useravatar
Offline
4 Posts
Administrator has disabled public posting

Re: changing/targeting specific area of template

Hi Dan,

that's a good question. Here's how I do it.

In the PHP box in the SUCCEED or FAIL action, I do this:

define("ON_SUCH_AND_SUCH_PAGE", true);

Then in the template, or anywhere else in the system (e.g. in a component, module or plugin, you can use:

if (defined("ON_SUCH_AND_SUCH_PAGE")) {
  // do some stuff here based on the success of the Chameleon rule
}


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
3313 Posts
User info in posts
Administrator has disabled public posting

Re: changing/targeting specific area of template

Hi Stephen

Thanks for replying. I'll give that a try (although my php knowledge is very basic).

Dan

trailofdan
Beginner Modder
ranks
useravatar
Offline
4 Posts
Administrator has disabled public posting

Re: changing/targeting specific area of template

The other thing you can do of course is to make modifications to your template based on CSS. There's a box in the Succeed action where you can put in some CSS code or include an external CSS file. So if you're better at CSS than PHP you could use that to modify layout, colours etc - anything that you can alter with CSS.

And this is of course as a result of the Chameleon rule, so can be targetted onto any page or for any user agent, time of day, GeoIP, whatever.

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
3313 Posts
User info in posts
Administrator has disabled public posting

Re: changing/targeting specific area of template

Hi Stephen

okay....I'll also try the css method. Basically what the situation is, is that my main template has four boxes in the main joomla component and when info in one of these boxes is selected the template changes to six boxes (so not a lot actually changes itself). I don't really want to have lots of slightly different templates installed which bloats and slows down the website.

trailofdan
Beginner Modder
ranks
useravatar
Offline
4 Posts
Administrator has disabled public posting

Re: changing/targeting specific area of template

Yes, I know what you mean. The PHP code I suggested is fairly basic, and the sort of code you should learn to write in order to do basic template modifications, e.g. being able to remove certain module positions on certain pages, etc. But if you can do it with CSS then so much the better.

All the best,
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
3313 Posts
User info in posts
Administrator has disabled public posting

Re: changing/targeting specific area of template

Cool...looks like this will be a good reason for me to get to grips with php. Thanks for all your help Stephen

trailofdan
Beginner Modder
ranks
useravatar
Offline
4 Posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1679
Total Polls:
6
Total Posts:
5913
Dormant:
User Info:
 
Total Users:
10734
Newest User:
gudad2
Members Online:
3
Guests Online:
190


Forum Legend:

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