How to add Color Theme option on J2.5 templates

In this tutorial i will explain on how to add color theme option on your joomla 2.5 templates by adding fields on template parameters.

In your templateDetails.xml, paste this codes

<fieldset name="COLOR">    <field name="theme" type="list" default="Default" label="Color Theme" description="Choose Color theme from list">
    <option value="default.css">Default</option>
    <option value="red.css">Red</option>
    <option value="blue.css">Blue</option>
    </field>
</fieldset>

And then on index.php file, you will need to call this param function, paste this codes at the top of your index.php page, inside the php

$templateparams = $app-&gt;getTemplate(true)-&gt;params;

and in order for the css code to function call it through adding this code inside the head tag

<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/colortheme/<?php echo $this->params->get( 'theme' ) ?>" type="text/css" />

Please note that you will need to add different color style on each css files that been added, for it to take an effect and to select the color theme, you have to login to your administrator and on template manager select your template and you must see the color theme option at the right side area.

Hope this helps.

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll To Top