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屋!
查看全文