Chameleon: Control Joomla templates, menus & more
Introduction see more videos
Regain control over when different templates are used on your Joomla site, and which menu items are displayed:
Video tutorials now available!
Chameleon is based on the same revolutionary rule engine as MetaMod.
If a rule succeeds, you can redirect to a certain page or URL, set cookies, disable certain menu items or plugins, change the site home page ("Default" menu item), change which menu item will be displayed as “Active”, add page titles/keywords/meta-descriptions, find and replace page text, set the page language, and/or execute arbitrary PHP code.
Also available: ChameleonLite (free, download here, Joomla 1.5 only) gives you the flexibility of Chameleon, except that you have to code the rules in PHP (see FAQ). You still get the management interface and succeed/fail actions, but none of the drop-downs and select boxes for built-in rules, mentioned above.
Yes. From version 2.23, released 08 March 2012, Chameleon 2.23 works on both Joomla 1.7 and Joomla 2.5.
Note: the Joomla 1.5 version, and the Joomla 2.5-3.3 versions of Chameleon are separate products and must be purchased separately. This is because of the huge amount of work that it took to port Chameleon from Joomla 1.5 to 1.7, which resulted in a near rewrite of Chameleon.
Joomla allows you to set a default template for your site, then assign alternative templates to different menu items. That’s all. There’s no facility for assigning different templates to different groups of users (e.g. Registered/Author/Editor etc, or “non-logged-in” users). There’s no facility for assigning a template to particular articles, sections or categories, nor web domains, nor browser types.
There are good reasons to want to do all of these things. Joomla’s addiction to “Menu Items” makes it very difficult to achieve fine control over what template gets displayed when. Chameleon changes all that.
If you are using Joomla 2.5-3.3, there is no Lite version — only the full version is available.
Chameleon and ChameleonLite are built around the same rule engine. ChameleonLite has fewer form controls than Chameleon (e.g. it doesn’t have a form control for users or user groups) — the rest you have to code yourself in PHP. There’s a lot of help built in to the interface, and many MetaMod Recipes can be used for ChameleonLite with minimal modification.
Chameleon has some very useful rules built-in and is highly recommended. It’s much easier to configure (unless you’re a PHP genius of course, in which case grab the Lite version and enjoy!).
Rules are a way of describing what you want to happen on your site. In plain English, you might describe a situation this way:
The challenge is to make a way to put these rules together using form elements.
Chameleon (and the Lite version) allow you to create individual rules. Within each rule you can specify values for things like language, users, groups, browser types etc. In order for the rule to “Succeed”, every condition you specify within that rule has to succeed. If any of the conditions fail, then the end result of the rule is a “Fail”.
At the end of the rule (the Action), you specify what you want to happen for a Success or Failure. You can get the rule to immediately set a given template, or get it to fall through to the next rule. You can also get the rules to redirect to a certain page, set cookies, and/or execute some PHP code.
Using this system, you can create chains of rules that AND and OR together. If you can’t create the exact rule that you want, you have the opportunity to code it in PHP, which is an even more expressive language.
In the first rule, set the Action for Success to return the desired template. Set the Action for Failure to not change the template, and “Process next rule”.
In the second rule, do the same thing.
In this way, if the first rule does not succeed, the second one will be tried. If that does not succeed, then you can set an alternative Action, or just fall through and don’t change the template.
In the first rule, set the Action for Success to set the desired template, but “Process next rule”. Set the Action for Failure return an alternative template or to “Stop Processing”.
In the second rule, do the same thing.
In this way, the template will only be set if both the first and second rules Succeed.
No. However, Chameleon and ChameleonLite both have the ability to pick up the GET, POST, COOKIE or session variables set by most of the common front-end template switchers, and can take these into account in the rules. The option is named “Honour template set in session/cookies/GET/POST”. When this is set, if Chameleon detects one of these cookies then it sets the requested template as the default template, then continues processing the rules. The rules can override this template, or, by not setting their own template, the default will be passed through to Joomla and activated.
(available from v1.3). This is a common thing to want to do. e.g. you are checking the HTTP referrer, and you want to switch to a particular template if the browser is coming from your FaceBook page. Naturally, the referrer string is only http://www.facebook.com/some_page for the first page visited on your site – so you want Chameleon to remember the new template for the rest of the session.
Here’s how to do it:
If you use Permanent Cookie A-D instead of Session Variable A-D, then the template selection will be remembered on the visitor's web browser for up to 10 years, or less if they clear the cookies earlier. Remember to set this on both rules (setting it on the first one, and picking it up on the second).
The official manual is now available and contains full descriptions of all the forms and pages that are part of Chameleon and ChameleonLite.
MetaTemplate Pro and MetaTemplate were renamed to Chameleon and ChameleonLite in August 2011, to coincide with the release of the Joomla 1.7-compatible version.
The change was made because the product is capable of doing far more than just changing templates. It’s also capable of changing menu items on a page-by-page basis, changing which page is the home page, doing sophisticated redirections, and much more.
These other capabilities were being hidden because the name suggested that it was only about templates.
|Last Updated on Wednesday, 15 July 2015 02:13|