What I really like in Teline II are the colors. These are assigned to specific section/category with the ja_news module.
Now, it come to my mind, what if I want a different color for another extension or for menu item to section/category that I don’t want to display in JA News.
OK, there are two approaches, first one is extension based, and the second one is menu item based.
Solution 1 – you want a color for all pages of specific extension (in my case – Fireboard):
First, we need to add a check for the component in use.
After <jdoc:include type=”head” /> in index.php of the template, add this code:
<?php
function isFireboard(){
return (JRequest::getCmd('option')=='com_fireboard');
}
?>
(Note: you will need to rename the function if you add it more then one time. i.e. rename it to isCommunityBuilder if you use it with CB)
The second thing we have to do, is to add the color switch. Find:
<link href="<?php echo $tmpTools->templateurl(); ?>/css/colors/theme<?php echo $tmpTools->getThemeForSection(); ?>.css" rel="stylesheet" type="text/css" />
Right after it, add the following line:
<?php
if ( isFireboard() ){ ?>
<link href="<?php echo $tmpTools->templateurl(); ?>/css/colors/theme-red.css" rel="stylesheet" type="text/css" />
<?php }?>
Now, our forum will always appear in red.
Solution 2 – menu item based solution
Imagine that you have a link to an uncategorized article that you want to be in different color.
Go to the menu manager and check the column with the Itemid of the link you want to colorize. Let’s say it is 76. Find in your template:
<link href="<?php echo $tmpTools->templateurl(); ?>/css/colors/theme<?php echo $tmpTools->getThemeForSection(); ?>.css" rel="stylesheet" type="text/css" />
and right after it, add the following line
<?php
$Itemid = JRequest::getInt( 'Itemid');
if ($Itemid==76) { ?>
<link href="<?php echo $tmpTools->templateurl(); ?>/css/colors/theme-red.css" rel="stylesheet" type="text/css" />
<?php } ?>
Now on that link, the page will appear in red 😉