现在我正在探索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>
Run Code Online (Sandbox Code Playgroud)
什么是<update />标签吗?
vzw*_*ick 55
该<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>
Run Code Online (Sandbox Code Playgroud)
生成的XML bar将是:
<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>
Run Code Online (Sandbox Code Playgroud)
TL;博士:该update手柄基本上是一个"合并这个布局我目前的布局".
此句柄用于将现有布局句柄合并到当前布局.在您的示例中,<update handle="editor"/>将添加<adminhtml_catalog_product_edit>以下内容:
<editor>
<reference name="head">
<action method="setCanLoadExtJs"><flag>1</flag></action>
<action method="addJs"><script>mage/adminhtml/variables.js</script></action>
<action method="addJs"><script>mage/adminhtml/wysiwyg/widget.js</script></action>
<action method="addJs"><script>lib/flex.js</script></action>
<action method="addJs"><script>lib/FABridge.js</script></action>
<action method="addJs"><script>mage/adminhtml/flexuploader.js</script></action>
<action method="addJs"><script>mage/adminhtml/browser.js</script></action>
<action method="addJs"><script>prototype/window.js</script></action>
<action method="addItem"><type>js_css</type><name>prototype/windows/themes/default.css</name></action>
<action method="addItem"><type>js_css</type><name>prototype/windows/themes/magento.css</name></action>
</reference>
</editor>
Run Code Online (Sandbox Code Playgroud)
("编辑器"句柄定义app/design/adminhtml/default/default/layout/main.xml)
| 归档时间: |
|
| 查看次数: |
20235 次 |
| 最近记录: |