Skip to content

Instantly share code, notes, and snippets.

@andergmartins
Created October 14, 2012 22:59
Show Gist options
  • Save andergmartins/3890086 to your computer and use it in GitHub Desktop.
Save andergmartins/3890086 to your computer and use it in GitHub Desktop.
Get Joomla menu item params anywhere
$app = JFactory::getApplication();
$menuItem = $app->getMenu()->getActive();
$pageclass_sfx = $menuItem->params->get('pageclass_sfx');
$bodyClass = !empty($pageclass_sfx) ? "class=\"item-page$pageclass_sfx\"" : '';
?>
<body <?= $bodyClass; ?>>
@andergmartins
Copy link
Author

In template index.php, you can use like that:

<body class="item-page<?php echo $pageclass_sfx?>">

@thejohn
Copy link

thejohn commented Dec 11, 2014

Nice job.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment