Magento – 使用更新XML删除块
发布时间:2020-12-16 07:56:10 所属栏目:百科 来源:网络整理
导读:如何使用布局xml文件删除已有的块?具体来说,我想从名为“top.switches”的块中删除名为“货币”的块.它正被插入到directory.xml文件中,如下所示: default reference name="top.switches" block type="directory/currency" name="currency" before="store_l
如何使用布局xml文件删除已有的块?具体来说,我想从名为“top.switches”的块中删除名为“货币”的块.它正被插入到directory.xml文件中,如下所示:
<default> <reference name="top.switches"> <block type="directory/currency" name="currency" before="store_language" template="directory/currency.phtml"/> </reference> <reference name="head"> <block type="core/template" name="optional_zip_countries" as="optional_zip_countries" template="directory/js/optional_zip_countries.phtml" /> </reference> </default>
通过另一个xml文件,可以通过两种方法来删除在一个布局xml文件中定义的块:
<default> <reference name="top.switches"> <action method="unsetChild"><name>currency</name></action> </reference> </default> 而且你通常希望这样做的方式: <default> <reference name="top.switches"> <remove name="currency" /> </reference> </default> 您可以找到各种布局xml元素here的说明,但不包括可用于操作标签的方法.为此,您需要查看块类app / code / core / Mage / Core / Block / Abstract.php,它们具有各种有用的功能,如unsetChild,unsetCallChild,insert,sortChildren等. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |