Magento 主页上的静态块 [英] Static block on home page in Magento
本文介绍了Magento 主页上的静态块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用布局 XML 文件向 Magento 站点的主页添加一个静态块.
I am trying to add a static block to the home page of a Magento site using the layout XML file.
我可以看到如何在引用中添加和删除块,但我正在努力了解如何为特定页面(即主页)添加它.
I can see how to add and remove block inside a reference, but I am struggling to see how to add it for a specific page, i.e. the home page.
<block type="cms/block" name="home-page-block">
<action method="setBlockId"><block_id>home-page-block</block_id></action>
</block>
我将如何将此代码包装在 page.xml
文件中以使其仅在主页上使用?
或者,还有更好的方法?主页应该是新模板吗?
How would I wrap this code in the page.xml
file for it to be only used on the homepage?
Or is there a better way? Should the home page be a new template?
推荐答案
在您的主题使用的任何布局文件中添加以下内容.
In any layout file used by your theme add the following.
<cms_index_index>
<reference name="content">
<block type="cms/block" name="home-page-block">
<action method="setBlockId"><block_id>home-page-block</block_id></action>
</block>
</reference>
</cms_index_index>
cms_index_index
特定于主页.
这篇关于Magento 主页上的静态块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文