加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Magento local.xml布局文件 – 覆盖

发布时间:2020-12-16 23:26:48 所属栏目:百科 来源:网络整理
导读:有没有办法使用local.xml覆盖或重新添加通过它的xml布局删除的东西? 我做了一个主题,全部基于一个页面布局,2columns-left.但是很多页面(例如站点地图)都设置为使用1列布局.例如,在catalog.xml中,我们有: catalog_SEO_sitemap translate="label" labelCatal
有没有办法使用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>

在我的local.xml中,我可以通过添加以下内容来覆盖要使用的根模板:

<catalog_SEO_sitemap>
<reference name="root">
    <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
</reference>
</catalog_SEO_sitemap>

所以它现在以2列左侧布局显示站点地图.但左栏中没有任何内容,因为<删除name =“left”/>已删除它.我讨厌我必须覆盖整个catalog.xml只是为了删除它,因为这是一个痛苦,然后当他们更新到新版本时,我需要更新所有这些额外的布局文件.

那么,有没有办法使用我的local.xml来解决这个问题?我认为对于默认的Magento主题,他们应该将所有设置都设置为使用3列布局,因为你可以随意删除任何你不需要的东西,但默认情况下都是这样,所以所有更改都可以在local.xml文件.

解决方法

开箱即用,无法删除之前调用< remove />已删除的布局块. “

但是,布局系统中有足够的事件可以让您自己实现.而对于“你自己”,我的意思是我created an experimental extension增加了一个< unremove />标记到XML Layout系统的语法.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读