有没有办法使用local.xml覆盖或重新添加通过它的xml布局删除的东西?
我做了一个主题,全部基于一个页面布局,2columns-left.但是很多页面(例如站点地图)都设置为使用1列布局.例如,在catalog.xml中,我们有:
<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>
Run Code Online (Sandbox Code Playgroud)
在我的local.xml中,我可以通过添加以下内容来覆盖要使用的根模板:
<catalog_seo_sitemap>
<reference name="root">
<action method="setTemplate"><template>page/2columns-left.phtml</template></action>
</reference>
</catalog_seo_sitemap>
Run Code Online (Sandbox Code Playgroud)
所以它现在以2列左侧布局显示站点地图.但左栏中没有任何内容,因为<remove name ="left"/>已将其删除.我讨厌我必须覆盖整个catalog.xml只是为了删除它,因为这是一个痛苦,然后当他们更新到新版本时,我需要更新所有这些额外的布局文件.
那么,有没有办法使用我的local.xml来解决这个问题?我认为对于默认的Magento主题,他们应该将所有设置都设置为使用3列布局,因为你可以随意删除任何你不需要的东西,但默认情况下都是这样,所以所有更改都可以在local.xml文件.
之前已经提出这个问题,但没有达成任何结论.您可以在local.xml中创建替换块,但不能保证在您进行本地更改后将添加到子块中.
<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>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
11925 次 |
最近记录: |