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;
?>

Comments

comments

Powered by Facebook Comments

Related Posts



5 Responses to How to get Current page url in magento.

Avatar

Micky

November 13th, 2011 at 6:29 am

May be this is also helpful to people

how to call phtml in magento :

$this->getLayout()->createBlock(‘catalog/product_list’)->setTemplate(‘catalog/product/list.phtml’)->toHtml();

Avatar

Devid

December 12th, 2011 at 6:27 pm

Please look at this url

this help to make dynamic module

http://www.silksoftware.com/magento-module-creator/

Avatar

Devid

January 18th, 2012 at 9:33 am

Avatar

Web Form Generator

April 26th, 2013 at 9:29 am

Nice post. I was checking continuously this weblog and I am inspired! Extremely helpful information specifically the final part :) I handle such info a lot. I used to be looking for this certain information for a long time. Thank you and good luck.

Avatar

Sbobet

January 4th, 2014 at 4:43 am

Simplу wish to say your article is as suгprising.
The cleаrness in your pοst is simply nice and
i could assume you are an expeгt on this subјect.

Well with yοur permisѕion let me to grab your feed to keep up to date with forthcοming post.
Thanks a million and please continue the enϳoyable work.

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=""> <strike> <strong>