Check home page URL in magento

April 18, 2011 | In: Magento

Check current page is home page in magento

If you want to check current page is home page or not in magneto below code is helpful to you.

<?php 
if(
Mage::getSingleton('cms/page')->getIdentifier() == 'home'  &&
Mage::app()->getFrontController()->getRequest()->getRouteName() == 'cms' 
) : 
?>

The other way you can check current page is home page or not in magento

<?php
if($this->getUrl('') == $this->getUrl('*/*/*', array('_current'=>true, '_use_rewrite'=>true))):
	echo "Homepage";
else:
	echo "Not in Homepage";
endif;
?>

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Inquire Now
  • captcha
 

Categories


PSD to Magento Advertisement Advertisement Advertisement


Latest comments

  • None found