How to add "article" or "blog" to body tag class

196 views
Skip to first unread message

pethr

unread,
Jun 13, 2012, 3:09:16 PM6/13/12
to Gantry Framework for Joomla Users
Hi,

Gantry framework for J1.5 used to add "layout-blog" "view-article" to
body class. this doesn't seem to be an option anymore in J2.5 version.
Is there anything I can modify to restore this functionality? I need
to style article and blog views with different parameters. Any help
appreciated! Thank you.

Petr

pethr

unread,
Jun 13, 2012, 5:21:24 PM6/13/12
to Gantry Framework for Joomla Users
OK, to answer my own question: http://magazine.joomla.org/component/k2/item/346

Place this above <html> in template index.php file:
<?php
// Detecting Active Variables
$option = JRequest::getCmd('option', '');
$view = JRequest::getCmd('view', '');
$layout = JRequest::getCmd('layout', '');
$task = JRequest::getCmd('task', '');
$itemid = JRequest::getCmd('Itemid', '');
?>
Modify your body tag to look something like this:
<body id="<?php echo $option . " " . $view . " " . $layout . " " .
$task . " itemid-" . $itemid;?>" <?php echo $gantry-
>displayBodyTag(); ?> >

I'm using only the $layout part. Now if you can add this back to
Gantry I think it would be very useful.
Reply all
Reply to author
Forward
0 new messages