B-219 Sec-55 Noida, India

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>
          <a href=”<?php echo $this->getUrl(”) . ‘about-us’ ?>”><?php echo $this->__(‘About Us’)  ?></a>
          <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 :-

$url2 = $this->getUrl();
$url1 = Mage::helper(‘core/url’)->getCurrentUrl();
(Visited 65 times, 1 visits today)

Leave a reply

You must be logged in to post a comment.