1

Hi I've been reading on layout updates, on hide the block "header_slider" on all subpages, i.e., category, product and check out pages. I would like to keep it on the home page.

I've looked at the file.

/app/design/frontend/myinterface/mycustometheme/local.xml

and found this:

<reference name="top.container">

<block type="cms/block" name="header_slider">

<action method="setBlockId"><block_id>header_slider</block_id></action>

</block>

</reference>

I was able to remove the slider from all pages under CMS>Pages, by adding this code in the Layout Update XML:

<remove name="header_slider"/>

However, all header_sliders disappear, even on the home page, when I try to add this line in either of these xml files:

app/design/base/default/layout/checkout.xml

app/design/base/default/layout/catalog.xml

I put it into between the <default></default> tags.

I'm not sure is I have the heiarchy of the theme correct?

Thanks for your help.

1

You have a couple of options.

1st: You could remove the code from the local layout file and insert it into your CMS Page for the homepage under the design tab in the layout box. That would then only load it on the homepage.

The other option would be this. However, the above method would be best.

You could always just check to see if the current page is the home page before executing the script.

Open the file that contains the slider info. Add this to it.

<?php if (Mage::helper('core/url')->getCurrentUrl() === Mage::helper('core/url')->getHomeUrl()):?>

//Slider code here

<?php endif; ?>
  • Thank you very much for your help!!! I think I did that approach originally, but forgot to clear the cache, but I tried your recommendation the top one, it worked great!! – user4110 Nov 28 '13 at 0:37
  • You are welcome :) – user693 Nov 28 '13 at 1:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.