Sometimes we want to check that current page is homepage or not through the code in Magento. In this post I am trying to solve such kind of the problem, It is very simple and you can get this from the code below:
Method 1:
<?php if($this->getIsHomePage()) { echo 'Hello Its Homepage!'; } else { echo 'Its not Homepage!'; } ?>
Method 2:
<?php $route = Mage::app()->getRequest()->getRouteName(); $pageidentifier = Mage::getSingleton('cms/page')->getIdentifier(); if($route == 'cms' && $pageidentifier == 'home') { echo 'Hello Its Homepage!'; } else { echo 'Its not Homepage!'; } ?>
Hope this helps, Thanks and Enjoy the Magento Coding.