You are viewing an old revision of this post, from February 25, 2014 @ 14:26:19. 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:26:19Current 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(
Unchanged: Mage::getSingleton( &#39;cms/page&#39; )-&gt;getIdentifier() == &#39;home&#39; &amp;&amp;Unchanged: Mage::getSingleton( &#39;cms/page&#39; )-&gt;getIdentifier() == &#39;home&#39; &amp;&amp;
Unchanged: Mage::app()-&gt; getFrontController()-&gt; getRequest()- &gt;getRouteName() == &#39;cms&#39; Unchanged: 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