Created
April 15, 2013 01:47
-
-
Save MaxLynam/5385142 to your computer and use it in GitHub Desktop.
Joomla Template Class Code
based on code from NormDouglas ... so all credit to him for sharing { Thanks }
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
<!-- The following section should be placed somewhere high up in your index.php of your template. | |
Note that some templates will not use the index.php for the main file --> | |
<!-- ********** CODE START ********** --> | |
<?php | |
$active = JFactory::getApplication()->getMenu()->getActive(); | |
?> | |
<?php | |
$menu = &JSite::getMenu(); | |
$active = $menu->getActive(); | |
$menuname = $active->title; | |
$parentId = $active->tree[0]; | |
$parentName = $menu->getItem($parentId)->alias; | |
$subparentID = $active->tree[1]; | |
$subparentName = $menu->getItem($subparentID)->alias; | |
if(JFactory::getUser()->guest) { | |
$loggedin = 'loggedout'; | |
} | |
else { | |
$loggedin = 'loggedin'; | |
} | |
?> | |
<?php | |
$app = JFactory::getApplication(); | |
$menu = $app->getMenu(); | |
if ($menu->getActive() == $menu->getDefault()) { | |
$ishome = 'ishome'; | |
} | |
else $ishome = 'nothome'; | |
?> | |
<!-- ********* CODE END ************** --> | |
<!-- The next section should be placed as a DIV tag within your existing template structure. | |
Experience shows us that it's best placed immediately inside of the main wrapping div tag --> | |
<!-- ************ CODE START ************* --> | |
<div id="<?php echo strtolower($parentName); ?>" class="<?php echo strtolower($subparentName).' '.$active->alias; ?> <?php echo $ishome; ?> <?php echo $loggedin; ?>"> | |
<!-- ************ CODE END *************** --> | |
<!-- @@@@************* IMPORTANT NOTICE ***********@@@@@ --> | |
<!-- Please remember to add an additional closing DIV </div> tag at the end of your template file... to close the new div tag you have added at the top of your index. | |
Generally this will be immediately before the last closing div tag --> | |
<!-- Have fun --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
note this is old implementation ... most recent implementation in Joostrap.com templates