Magento - 将 CMS 块添加到一页 [英] Magento - Add CMS Block to One Page

查看:28
本文介绍了Magento - 将 CMS 块添加到一页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 xml 布局文件中有此代码:

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>

我想使用以下代码向博客页面添加一个 cms 静态块:

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?

谢谢.

这里是整个 xml 文件:

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> 

推荐答案

如果它进入一个部分,那么它将应用于所有页面,你想把它和它的内容放在部分中(会有列表页面和单个帖子页面 - 这些部分应该已经存在于 aw_blog.xml 文件中

if it's going inside a section then it will be applied to all pages, you want to put the and its contents inside the sections (there'll be the listing page and individual post pages - the sections should already exist in the aw_blog.xml file

这篇关于Magento - 将 CMS 块添加到一页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆