Magento check if the current page is home page

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' ) :
?>

//Do something here

<?php

endif;

?>

Continue reading »

Magento check if the current page is a category page or not

We can use the following code to check if we are on a category page or not

<?php  if (Mage::registry('current_category')) : ?>
//Do something here
<?php  endif; ?>

Continue reading »

Back to top