How do I add block that is working only for home page in magento?

I want to display slider in homepage only not for the rest of the cms pages.My banner script is in the header.phtml  file.

Junior Developer Asked on January 26, 2017 in MAGENTO.
Add Comment
1 Answer(s)

You can try my code.It’s working for me.

<?php
// IF WE ARE ON HOMEPAGE
if(Mage::getSingleton(‘cms/page’)->getIdentifier() == ‘home’ &&
Mage::app()->getFrontController()->getRequest()->getRouteName() == ‘cms’
) : ?>

// Slider/Banner Code Block

<?php endif; ?>

 

 

Senior Developer Answered on January 26, 2017.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.