Question

Hi i'm using below code in my cms page->design->layout update xml

<reference name="left">
<block type="cms/block" name="Cms Pages Left Sidebar" as="Cms Pages Left Sidebar" before="-">  
       <action method="setBlockId"><block_id>cms_pages_left_sidebar</block_id></action>  
    </block>
</reference>

Everything working fine, but i have more then 200 pages, so it's a tidious process to update in all pages.

So i've added the same in mytheme's config.xml but now the issue is it's coming in product and category pages too.

Is there any way to show them only in cms pages ?

Was it helpful?

Solution

Welcome to Magento.SE and great job getting this far in figuring out layout XML.

Firstly, I would advise you that you do not place this in the config.xml file. It is advisable to place it into a layout update file.

Secondly, you're very close here - the only thing you need to do is target the CMS "handle" (a fancy name for the topmost node in the layout xml) - looks like you're already targeting something - likely default or root.

Instead use this:

<cms_page>
    <reference name="left">
    <block type="cms/block" name="Cms Pages Left Sidebar" as="Cms Pages Left Sidebar" before="-">  
           <action method="setBlockId"><block_id>cms_pages_left_sidebar</block_id></action>  
        </block>
    </reference>
</cms_page>
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top