You are viewing an old revision of this post, from February 25, 2014 @ 14:19:49. See below for differences between this version and the current revision.

Check current page is home page or not

Using the code below to check current page is home page or not.
<?php if(
Mage::getSingleton('cms/page')->getIdentifier() == 'home'  &&
Mage::app()->getFrontController()->getRequest()->getRouteName() == 'cms' 
) : ?>

//insert your code here 

<?php endif; ?>

Revisions

Revision Differences

February 25, 2014 @ 14:19:49Current Revision
Content
Unchanged: <pre>Unchanged: <pre>
Deleted: <code style="border: 0px;font-family: Monaco, Consolas, 'Andale Mono', 'DejaVu Sans Mono', monospace;margin: 0px;padding: 0px;vertical-align: baseline;line-height: normal">&lt; ?php if( Added: <code style="border: 0px;font-family: Monaco, Consolas, 'Andale Mono', 'DejaVu Sans Mono', monospace;margin: 0px;padding: 0px;vertical-align: baseline;line-height: normal">Using the code below to check current page is home page or not.
 Added: &lt;?php if(
Deleted: Mage::getSingleton( &#039;cms/page&#039;)-&gt; getIdentifier() == &#039;home&#039; &amp;&amp; Added: Mage::getSingleton( &#39;cms/page&#39; )-&gt;getIdentifier() == &#39;home&#39; &amp;&amp;
Deleted: Mage::app()-&gt; getFrontController()-&gt; getRequest()- &gt;getRouteName() == &#039;cms&#039; Added: Mage::app()-&gt; getFrontController()-&gt; getRequest()- &gt;getRouteName() == &#39;cms&#39;
Deleted: ) : ? &gt; Added: ) : ?&gt;
Unchanged: //insert your code here Unchanged: //insert your code here
Deleted: &lt; ?php endif; ? &gt;</code></pre> Added: &lt;?php endif; ?&gt;</code></pre>

Note: Spaces may be added to comparison text to allow better line wrapping.

No comments yet.

Leave a Reply