简体   繁体   English

Magento:在/ base / default / template内部改写phtml

[英]Magento: Override phtml inside /base/default/template

I'm trying to override 我正在尝试覆盖
app/design/frontend/base/default/template/contacts/ form.phtml . app / design / frontend / base / default / template / contacts / form.phtml

I followed several guides without success: 我遵循了一些指南,但均未成功:
I can only post one link since I don't have enough reputation to post more :( http://www.magento.scommerce-mage.co.uk/override-phtml-or-layout-core-files-in-magento.html 我只能发布一个链接,因为我没有足够的声誉来发布更多链接:( http://www.magento.scommerce-mage.co.uk/override-phtml-or-layout-core-files-in-magento .html

In fact I'm even more confused now since they are all using different approaches. 实际上,我现在更加困惑,因为他们都使用不同的方法。 At the moment I'm trying to do it like in the last guide since this is the most up to date one(2014) without success so far. 目前,我正在尝试像上一本指南中那样做,因为这是迄今为止最新的(2014年),目前还没有成功。

So here is what I got: 所以这就是我得到的:
app/code/local/Namespace/MyModule/etc/ config.xml 应用程序/代码/本地/命名空间/ MyModule / etc / config.xml

<config>
    <frontend>
        <layout>
            <updates>
                <contactredirect>
                    <file>contactredirect.xml</file>
                </contactredirect>
            </updates>
        </layout>
    </frontend>
</config>



app/design/frontend/base/default/layout/ contactredirect.xml 应用/设计/前端/基础/默认/布局/ contactredirect.xml

<layout version="0.1.0">
    <contacts_index_index translate="label">
        <reference name="contacts.form">
            <action method="setTemplate">
                <template>contactredirect/form.phtml</template>
            </action>
        </reference>
    </contacts_index_index>
</layout>



And finally the location of my form.phtml (the content probably doesn't matter): 最后是我的 form.phtml的位置(内容可能无关紧要):
app/design/frontend/base/default/template/contactredirect/ form.phtml . app / design / frontend / base / default / template / contactredirect / form.phtml

Any help is appreciated! 任何帮助表示赞赏!

use "contactForm" in reference name ie code should be-- 在参考名称中使用“ contactForm”,即代码应为-

<reference name="contactForm">
            <action method="setTemplate">
                <template>contactredirect/form.phtml</template>
            </action>
        </reference>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM