一:<reference>标签表示替换一个已经存在的块。例如:
<block type="page/html" name="root" output="toHtml" template="page/2columns-left.phtml">
<!-- ... sub blocks ... -->
</block>
<reference name="root">
<block type="page/someothertype" name="root" template="path/to/some/other/template" />
<!-- ... sub blocks ... -->
</block>
</reference>
(注:Magento 首先会创建一个name为root的块,然后他发现有一个name也是root的reference标签,Magento就会把原来的那个root替换为 reference标签里的那个块。)
二:布局的handel标签 <模块名_控制器名_方法名>
1:default标签
表明这个layout布局将对多有的请求都有效。
2:<模块名_控制器名_方法名>
表明这个layout布局仅仅对对应的url请求有效
<customer_account_index>
<!-- ... -->
<update handle="customer_account"/>
<!-- ... -->
</customer_account_index>
三:update 标签
<customer_account_index>
<!-- ... -->
<update handle="customer_account"/>
<!-- ... -->
</customer_account_index>
customer模块account控制器index方法的请求
这段代码的意思是,如果一个请求包含了“customer_acount_index”操作,那么这个请求的布
局文件也应该包含“customer_account”操作标签下面的<block />和<reference />。
四:block标签及其属性
1:output属性
任何一个拥有output属性的块都是顶层块,在拥有多个顶层块的情况下Magento将按照块定义的先后顺序输出HTML
2:name属性
3:as属性
4:type属性
5:template属性
6:translate属性
7:module属性