我的local.xml设置如下:
<cms_index_index translate="label">
<reference name="content">
<block name="promos" type="page/html" template="cms/promos/homepage.phtml" as="promos" />
<block type="page/html_wrapper" name="home.footer">
<action method="setElementClass"><value>l-two-col group</value></action>
<block type="page/html_wrapper" name="home.footer.main">
<action method="setElementClass"><value>l-main</value></action>
<block type="page/html" name="featured_products" template="catalog/category/favourites.phtml" as="featured_products" />
</block>
<block type="page/html_wrapper" name="home.footer.side">
<action method="setElementClass"><value>l-sidebar</value></action>
<block type="vertnav/navigation" name="catalog.vertnav" as="vertnav" template="vertnav/left.phtml">
<action method="setCategoryId"><category_id>3</category_id></action>
</block>
</block>
</block>
</reference>
</cms_index_index>
我在模块布局xml文件中有以下代码,它正确地替换了'promos'块,但我不能让它对名为“featured_products”的块做同样的事情。
<cms_index_index translate="label">
<remove name="promos"></remove>
<reference name="content">
<block type="page/html" template="cms/promos/homepage-usa.phtml" as="promos" />
</reference>
</cms_index_index>
有没有人知道如何以与我对promos块相同的方式替换featured_products bloc?
我试过了:
<reference name="content">
<block type="page/html" template="cms/promos/homepage-usa.phtml" as="promos" />
<reference name="home.footer">
<reference name="home.footer.main">
<block type="page/html" name="featured_products1" template="catalog/category/favourites-usa.phtml" as="featured_products1" />
</reference>
</reference>
</reference>
提前致谢,
戴夫
答案 0 :(得分:1)
虽然你在 local.xml
,但我不确定你为什么不只是删除指令。无论如何:
<remove name="featured_products"/>
或
<action method="unsetChild" block="home.footer.main"><child>featured_products</child></action>
您应该始终在块中添加name
属性。