Last active
October 5, 2015 19:47
-
-
Save MaxLynam/2865584 to your computer and use it in GitHub Desktop.
Joomla - Custom CSS dependant on active menu item & children
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- START - class decalaration as well as check itemID, frontpage, etc - Max Lynam | @MaxOnTheHill --> | |
<?php | |
/* get current active page */ | |
$active = JFactory::getApplication()->getMenu()->getActive(); | |
?> | |
<body | |
<?php if ($itemId): ?> id="item<?php echo $itemId; ?>" <?php endif; ?> | |
class="<?php echo $active->alias; ?> | |
<?php if ($isFrontpage): ?>frontpage <?php endif; ?>" | |
> | |
<!-- END - class decalaration - Max Lynam | @MaxOnTheHill --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Joomla - Custom CSS dependant on active menu item & children | |
Author: Max Lynam | June 2012 | max@molehill.com.au | |
/*************************************************************/ | |
Edit the file "index.php" in your default template directory. | |
The alias of your active item will be inserted as a class on your body. | |
If the menu item alias is "home", you can then style everything on that page using the class body.home page. | |
example usage: | |
/**** CSS File ****/ | |
body rightcolumn | |
{ | |
/* rule for every page */ | |
} | |
body.home rightcolumn | |
{ | |
/* different rule for homepage */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment