Magento布局XML中的“update”元素做什么?
发布时间:2020-12-16 08:02:40 所属栏目:百科 来源:网络整理
导读:现在我正在探索Magento管理部分的内部,我偶然发现了这个XML: 文件:app / design / adminhtml / default / default / layout / catalog.xml,第55行 50 block type="core/template" template="catalog/wysiwyg/js.phtml"/51 /reference52 /adminhtml_catal
现在我正在探索Magento管理部分的内部,我偶然发现了这个XML:
文件:app / design / adminhtml / default / default / layout / catalog.xml,第55行 50 <block type="core/template" template="catalog/wysiwyg/js.phtml"/> 51 </reference> 52 </adminhtml_catalog_product_new> 53 54 <adminhtml_catalog_product_edit> 55 <update handle="editor"/> 56 <reference name="content"> 57 <block type="adminhtml/catalog_product_edit" name="product_edit"></block> 58 </reference> 什么是< update />标签做?
< update>基本上拉另一个手柄。
假设你有这个: <layout> <foo> <reference name="header"> <block type="cms/block" name="some_block" as="someBlock"> <action method="setBlockId"><block_id>some_block</block_id></action> </block> </reference> <reference name="left"> <block type="cms/block" name="some_totally_different_block" as="someTotallyDifferentBlock"> <action method="setBlockId"><block_id>some_totally_different_block</block_id></action> </block> </reference> </foo> <bar> <update handle="foo" /> <reference name="header"> <block type="cms/block" name="some_other_block" as="someOtherBlock"> <action method="setBlockId"><block_id>some_other_block</block_id></action> </block> </reference> </bar> </layout> 产生的条形码XML将是: <layout> <bar> <reference name="header"> <!-- Start of part pulled in from foo --> <block type="cms/block" name="some_block" as="someBlock"> <action method="setBlockId"><block_id>some_block</block_id></action> </block> <!-- End of part pulled in from foo --> <block type="cms/block" name="some_other_block" as="someOtherBlock"> <action method="setBlockId"><block_id>some_other_block</block_id></action> </block> </reference> <!-- Start of part pulled in from foo --> <reference name="left"> <block type="cms/block" name="some_totally_different_block" as="someTotallyDifferentBlock"> <action method="setBlockId"><block_id>some_totally_different_block</block_id></action> </block> </reference> <!-- End of part pulled in from foo --> </bar> </layout> tl; dr:更新句柄基本上是“将此布局与我当前的布局合并”。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |