且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在magento中覆盖管理模板文件?

更新时间:2023-11-29 21:32:22

我建议您创建一个新模板,并通过adminhtml部分的布局更新在模块中添加新设计. 例如:

I Recommend you that create a new template and add new design in your module with the layout update for the adminhtml section. For example:

在自定义扩展名的config.xml中,您可以使用以下方式更新adminhtml的布局:

In your config.xml of your custom extension you can update the layout of adminhtml with:

<adminhtml>
   <layout>
     <updates>
       <adminhtml>
                <file>yourcustomlayout.xml</file>
       </adminhtml>  
     </updates>
   </layout>
</adminhtml>

好吧,那么由于这种布局,您可以编写下一个代码来添加css,例如:

Ok, then since this layout you can write the next code to add a css for example:

<layout>
    <default>
        <reference name="head">
            <action method="addCss">
                <name>aw_all/css/window.css</name>
            </action>

        </reference>
    </default>
</layout>

在这种情况下,您需要为块添加自定义模板

In your case you need add you custom template for your block

<layout>
  <handle>
        <reference name="content">
            <block type="smspremium/adminhtml_smspremium" name="smspremium">
                <action method="setTemplate">
                   <template>customtemplate.phtml</template>
                </action>
            </block>
        </reference>
  </handle>
</layout>

如果您想拆散所有积木并替换成积木,可以将其设为unsetChild

If you want to discart all the block and replace with your block you can made unsetChild

<layout>
      <handle>
            <reference name="content">
                <action method="unsetChild"><name>your.last.block</name></action>

                <block type="smspremium/adminhtml_smspremium" name="smspremium">
                    <action method="setTemplate">
                       <template>customtemplate.phtml</template>
                    </action>
                </block>
            </reference>
      </handle>
 </layout>

此功能与前端布局相同,仅与目录的不同而已,因为您存储了文件. 对于模板:

This work same the frontend layout, only with the diference of the directory since you store your files. For Templates:

app/design/adminhtml/default/default/templates

对于布局:

app/design/adminhtml/default/default/layout

希望可以帮助您