且构网

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

Magento-使用更新XML删除块

更新时间:2023-11-30 13:54:40

有两种方法可以通过另一个xml文件删除在一个布局xml文件中定义的块:

There are two methods to remove a block defined in one layout xml file, through another xml file:

<default>
    <reference name="top.switches">
        <action method="unsetChild"><name>currency</name></action>
    </reference>
</default>

以及通常期望的操作方式:

And the way you are conventionally expected to do it:

<default>
    <reference name="top.switches">
        <remove name="currency" />
    </reference>
</default>

您可以找到有关各种布局xml元素的说明 ,但这并不涵盖action标签可用的方法.为此,您需要查看块类app/code/core/Mage/Core/Block/Abstract.php,该类具有各种有用的功能,例如unsetChild,unsetCallChild,insert,sortChildren等.

You can find an explanation of the various layout xml elements here, but it doesn't cover the methods available to the action tag. For that, you need to look at the block class app/code/core/Mage/Core/Block/Abstract.php, which features all sorts of useful functions such as unsetChild, unsetCallChild, insert, sortChildren, etc.