Home    Articles

 

How to identify if you are on the homepage in magento

 

You may need to display a custom code or something specific for the hompage, and you need to identify the homepage…
In order to know if you are on the magento’s homepage use tis code:

<?php
$isHome = (Mage::getSingleton('cms/page')->getIdentifier() == 'home') ? true :false;
if(isHome)
{
    echo 'I am on homepage.';
}
else
{
    echo 'This is not the homepage.';
}
?>

That’s all.

by