B-219 Sec-55 Noida, India
+918010221733

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();
?>

(Visited 63 times, 1 visits today)

Leave a reply

You must be logged in to post a comment.