1

我的 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>

有谁知道我如何以与我已经为促销块所做的相同的方式替换 features_products 块?

我努力了:

<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> 

提前致谢,

戴夫

4

1 回答 1

1

虽然您在local.xml,但我不确定您为什么不只是删除指令。在任何情况下:

  1. <remove name="featured_products"/>或者

    <action method="unsetChild" block="home.footer.main"><child>featured_products</child></action>
    
  2. 您应该始终name为您的块添加一个属性。

于 2013-09-21T15:10:38.893 回答