面向未来Magento的XML重写 [英] Future-proofing a Magento XML override

查看:63
本文介绍了面向未来Magento的XML重写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道,说如果我想修改的Magento的核心文件之一,我应该复制该文件(并匹配目录树结构)从/应用程序/代码/核心成/应用Magento的最佳实践模式/代码/局部的,所以它会覆盖原有修改副本.我需要做的是与Magento的核心XML文件中的一个 - 我已经修改了文件,我想确保我的Magento升级它不会被覆盖后

I'm aware of the Magento best-practices pattern that says that if I want to modify one of Magento's core files, I should copy the file (and matching directory tree structure) from /app/code/core into /app/code/local and modify the copy so that it overrides the original. I need to do that with one of Magento's core XML files - I've modified the file, and I want to make sure that it doesn't get overwritten later when I upgrade Magento.

现在,我有一个适当的修改版本/app/code/core/Mage/Page/etc/config.xml - 我编辑它在一个特定的页面布局,我需要为我的网站添加.现在,我想将修改内容移出核心文件.我要在/app/code/local/Mage/Page/etc/config.xml中重新创建整个XML文件,还是只需要将添加和更改放入本地替代文件中?

Right now, I have a modified version /app/code/core/Mage/Page/etc/config.xml in place - I edited it to add in a specific page layout that I need for my site. Now I want to move my modification out of the core files. Do I recreate the entire XML file in /app/code/local/Mage/Page/etc/config.xml, or do I only need to put my additions and changes into a local override file?

如果是后者,有人可以解释这个结构给我好吗?

If it's the latter, can someone explain the structure of this to me please?

推荐答案

如果这不是太多XML,可以弹出它到应用程序的/etc/local.xml中这是我倾向于自定义布局做.

If it's not too much xml, you can pop it into app/etc/local.xml which is what I tend to do for custom layouts.

例如

<config>
  <global>
    <!-- ... -->
    <page>
      <layouts>
        <three_columns_test module="page" translate="label">
          <label>3 Columns Test</label>
          <template>page/3columns-test.phtml</template>
          <layout_handle>page_three_columns_test</layout_handle>
        </three_columns_test>
        <new_homepage module="page" translate="label">
          <label>Homepage Layout</label>
          <template>page/homepage.phtml</template>
          <layout_handle>page_homepage</layout_handle>
        </new_homepage>
      </layouts>
    </page>
    <!-- ... -->
  </global>
</config>

这篇关于面向未来Magento的XML重写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆