Magento local.xml布局文件-覆盖<;删除名称=";“左”/&燃气轮机;
是否有任何方法可以使用local.xml覆盖或重新添加通过其xml布局删除的内容 我已经做了一个主题,所有的基础上一页的布局,2列左。但是很多页面,比如站点地图,都设置为使用1列布局。例如,在catalog.xml中,我们有:Magento local.xml布局文件-覆盖<;删除名称=";“左”/&燃气轮机;,magento,Magento,是否有任何方法可以使用local.xml覆盖或重新添加通过其xml布局删除的内容 我已经做了一个主题,所有的基础上一页的布局,2列左。但是很多页面,比如站点地图,都设置为使用1列布局。例如,在catalog.xml中,我们有: <catalog_seo_sitemap translate="label"> <label>Catalog Seo Sitemap (Common)</label> <remove name="right"/&g
<catalog_seo_sitemap translate="label">
<label>Catalog Seo Sitemap (Common)</label>
<remove name="right"/>
<remove name="left"/>
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
</reference>
<reference name="content">
<block type="page/template_container" name="seo.sitemap.container" template="catalog/seo/sitemap/container.phtml">
<block type="page/template_links" name="seo.sitemap.links" as="links" template="page/template/links.phtml"/>
<block type="page/html_pager" name="seo.sitemap.pager.top" as="pager_top" template="page/html/pager.phtml"/>
<block type="page/html_pager" name="seo.sitemap.pager.bottom" as="pager_bottom" template="page/html/pager.phtml"/>
</block>
</reference>
</catalog_seo_sitemap>
目录Seo站点地图(通用)
第/1页column.phtml
在my local.xml中,我可以通过添加以下内容覆盖要使用的根模板:
<catalog_seo_sitemap>
<reference name="root">
<action method="setTemplate"><template>page/2columns-left.phtml</template></action>
</reference>
</catalog_seo_sitemap>
第页/2列-left.phtml
因此,它现在以2列左侧布局显示站点地图。但是在左栏中没有任何内容,因为<catalog_seo_sitemap>
<reference name="root">
<action method="setTemplate"><template>page/2columns-left.phtml</template></action>
<block type="core/text_list" name="left" as="left" translate="label">
<label>Left Column</label>
</block> <!-- Copied from page.xml -->
<block type="core/text_list" name="right" as="right" translate="label">
<label>Right Column</label>
</block> <!-- Copied from page.xml -->
</reference>
</catalog_seo_sitemap>
第页/2列-left.phtml
左列
右栏
开箱即用,无法撤消先前调用
删除的布局块
但是,布局系统中有足够的事件,您可以自己实现。说到“你自己”,我的意思是,我已经在XML布局系统的语法中添加了一个
标记。我在阅读时只需更改块名就可以做到这一点。似乎如果删除块并使用相同名称重新添加,则删除标签将应用于具有相同名称的所有块。在我的例子中,它是删除一个帐户导航并添加到标题中
<remove name="customer_account_navigation" />
<block type="customer/account_navigation" name="customer_account_nav" as="accountNavigation" template="customer/account/navigation.phtml">
sweeeeet!非常感谢你把这些放在一起。这真的会让我的东西更容易更新。Alan Storm的扩展插件在布局中添加的标签效果很好。它在Magento Connect中作为一个名为Layout_Unremove的模块提供。必须在
发生后进行可能的复制。为确保
不会影响您的更改,请将块命名为左.2
和右.2
。它们仍然可以通过别名left
和right
使用。