Magento布局XML中的“update”元素做什么?

前端之家收集整理的这篇文章主要介绍了Magento布局XML中的“update”元素做什么?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
现在我正在探索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:更新句柄基本上是“将此布局与我当前的布局合并”。

原文链接:/xml/293325.html

猜你在找的XML相关文章