Pages

Friday, July 5, 2013

magento : How to make active class in magento

Make a class in css like .mainmenu li.active a{ color:#f68e1e; }
<li> <a href=”<?php echo $this->getUrl(”) ?>”>  Home </a> </li>
     <li>
          <a href=”<?php echo $this->getUrl(”) . ‘about-us’ ?>”><?php echo $this->__(‘About Us’)  ?></a>
    </li>
   <li>
          <a href=”<?php echo $this->getUrl(”) . ‘product’ ?>”><?php echo $this->__(‘Product’)  ?></a>
    </li><?php if (strpos($_SERVER['REQUEST_URI'],’index’) != false )
{
echo ‘active’;
} ?>

Get Current Url In Magento :-

<?php
$url2 = $this->getUrl();
$url1 = Mage::helper(‘core/url’)->getCurrentUrl();
?>

No comments:

Post a Comment