Sometimes we might need to show a single static block in one or few specified categories only, rather than showing the static block on all pages.
The layout XML code below helps to achieve the above requirement. It will show the static block ‘my-sidebar-1′ on right sidebar of category with id ’10’. Similarly, static block ‘my-sidebar-2′ is displayed on the category page with id ’12’.
<CATEGORY_10>
<reference name="right">
<block type="cms/block" name="my.sidebar.1" before="-">
<action method="setBlockId"><block_id>my-sidebar-1</block_id></action>
</block>
</reference>
</CATEGORY_10>
<CATEGORY_12>
<reference name="right">
<block type="cms/block" name="my.sidebar.2" before="-">
<action method="setBlockId"><block_id>my-sidebar-2</block_id></action>
</block>
</reference>
</CATEGORY_12>
Hope this helps. Thanks.