The following code is used to check if the current page is homepage.
<?php if( Mage::getSingleton('cms/page')->getIdentifier() == 'home' && Mage::app()->getFrontController()->getRequest()->getRouteName() == 'cms' ) : ? >
The other way is to do the following way: works on 1.4.x
<?php if($this->getUrl('') == $this->getUrl('*/*/*', array('_current'=>true, '_use_rewrite'=>true))): echo "Homepage"; else: echo "Not in Homepage"; endif; ?>
Note: You can use “Mage::getUrl()” function where “$this” reference is not valid.
Very handy thanks a lot
Great, it’s helpful for me!
This function not working inside the top.phtml
Thanks dude, it saves my life.
=)
thanks budy i was finding from many time
this function working in header.phtml in magento 1.3 only.. it is not work in latest magento 1.4.1
Thanks buddy…
Give more details about this blog for subscribe. Thanks for this blog.
Exactly what I was looking for… there was another suggestion with using $_SERVER['REQUEST_URI']. But this didn’t work. Magento just showed nothing at all. Does anyone know why this is?
Thanks for script
its helpful
It was really a helpful stuff. I used the same method to get the inner page and to the needed changes which is applicable to specified page. Any code updation needed this code to work in magento 1.4.1?
Does not work in Magento 1.5. Do you have an update on this? Would be great!!
Thanks for sharing this information and resources its really help full for me with the help of this we can improve our magento working.
Web Design Company India
Very nice trick.
Thanks:)