Thứ Năm, 22 tháng 8, 2013

Joomla body page class, check Homepage

Joomla2.5.x và 3.x
Lấy pageclass theo menu page class để thực hiện style
<?php
  $itemid = JRequest::getVar('Itemid');
  $menu = &JSite::getMenu();
  $active = $menu->getItem($itemid);
  $params = $menu->getParams( $active->id );
  $pageclass = $params->get( 'pageclass_sfx' );
?>
<body id="bd" class="<?php echo $pageclass; ?>">



Check Homepage
<?php
$app = JFactory::getApplication();
$menu = $app->getMenu();
if ($menu->getActive() == $menu->getDefault()) {
        echo 'This is the front page';
}
?>

0 nhận xét:

Đăng nhận xét