Magento - Add CMS Block to One Page

Posted by a1anm on Stack Overflow See other posts from Stack Overflow or by a1anm
Published on 2010-02-07T21:39:44Z Indexed on 2010/04/10 6:23 UTC
Read the original article Hit count: 3302

Filed under:

I have this code in a xml layout file:

<reference name="left">     
      <block type="blog/blog" name="left.blog.menu"  before="-">            
    <action method="setTemplate" ifconfig="blog/menu/left">
       <template>aw_blog/menu.phtml</template> 
    </action>
        <block type="blog/tags" name="blog_tags" />
      </block>
</reference>

I want to add a cms static block to the blog pages using this code:

<block type="cms/block" name="brand_list">
    <action method="setBlockId"><block_id>brand_list</block_id></action>
</block>

If I add it in directly after this line:

<reference name="left"> 

It works but it is then displayed on every page. How can I get it to show only on the blog pages?

Thanks.

Edit: Here is the entire xml file:

<layout version="0.1.0">
    <default>
        <reference name="footer_links">
            <block type="blog/blog" name="add.blog.footer">
                <block type="blog/tags" name="blog_tags" />
                <action method="addFooterLink" ifconfig="blog/menu/footer"></action>
            </block>
        </reference>
        <reference name="right">
            <block type="blog/blog" name="right.blog.menu" before="-">
                <action method="setTemplate" ifconfig="blog/menu/right" ifvalue="1">
                    <template>aw_blog/menu.phtml</template> 
                </action>
                <block type="blog/tags" name="blog_tags" />
            </block>
        </reference>
        <reference name="left">     
            <block type="blog/blog" name="left.blog.menu"  before="-">          
                <action method="setTemplate" ifconfig="blog/menu/left">
                    <template>aw_blog/menu.phtml</template> 
                </action>
                <block type="blog/tags" name="blog_tags" />
            </block>
        </reference>
        <reference name="top.links">
            <block type="blog/blog" name="add.blog.link">
                <action method="addTopLink" ifconfig="blog/menu/top"></action>
                <block type="blog/tags" name="blog_tags" />
            </block>
        </reference>
        <reference name="head">
            <action method="addItem"><type>skin_css</type><name>aw_blog/css/style.css</name></action>
        </reference>
    </default>

    <blog_index_index>
        <reference name="content">
            <block type="blog/blog" name="blog" template="aw_blog/blog.phtml"/>
        </reference>
    </blog_index_index>

    <blog_index_list>
        <reference name="content">
            <block type="blog/blog" name="blog" template="aw_blog/blog.phtml"/>
        </reference>
    </blog_index_list>  
    <blog_post_view>
        <reference name="content">
            <block type="blog/post" name="post" template="aw_blog/post.phtml">
                <block type="socialbookmarking/bookmarks" name="bookmarks" template="bookmarks/bookmarks.phtml"/>
            </block>
        </reference>
    </blog_post_view>
    <blog_cat_view>
        <reference name="content">
            <block type="blog/cat" name="cat" template="aw_blog/cat.phtml" />
        </reference>
    </blog_cat_view>

    <blog_rss_index>
        <block type="blog/rss" output="toHtml" name="rss.blog.new"/>
    </blog_rss_index>
</layout> 

© Stack Overflow or respective owner

Related posts about magento