Magento块标记

Magento块标记,magento,Magento,请解释Magento块标记的所有属性 <block type="catalog/product_featured" name="product_featured" as="product_featured" template="catalog/product/featured.phtml"></block> <block type="catalog/product_featured" name="product_featured"

请解释Magento块标记的所有属性

<block type="catalog/product_featured" name="product_featured" 
     as="product_featured" 
     template="catalog/product/featured.phtml"></block>
<block type="catalog/product_featured" name="product_featured"              template="catalog/product/featured.phtml">
<action method="setLimit"><limit>2</limit></action>
 </block>

2.
还有,为什么我们需要两倍的块标记

<block type="catalog/product_featured" name="product_featured" 
     as="product_featured" 
     template="catalog/product/featured.phtml"></block>
<block type="catalog/product_featured" name="product_featured"              template="catalog/product/featured.phtml">
<action method="setLimit"><limit>2</limit></action>
 </block>
type=PHP文件模板将查找方法。。这里是Mage_Catalog_Block_Product_Featured.php

name=块的名称。它在页面中应该是唯一的

as=别名。名称的较小形式。它在其父块中应该是唯一的

template=此块附着到的模板文件(视图)。您可以使用
$this
,从该内部的块类型调用方法。。e、 g.$this->getName()

名称
作为
示例:

<reference name="left">
    <block type="block/type1" name="first_block" template="template1.phtml">
       <block type="abc/abc" name="abc" as="common" template="abc.phtml"/> 
    </block>
    <block type="block/type2" name="second_block" template="template2.phtml">
       <block type="xyz/xyz" name="xyz" as="common" template="xyz.phtml"/>            
    </block>
</reference>


因此,现在可以从
first_block
调用块名
abc
,从
second_block
调用
xyz
作为
$this->getChildHtml('common'),但请注意,调用的两个块将根据其调用父对象的不同而有所不同。

有文档和教程可以教您Magento块的基本知识。这里不适合要求解释Magento的基本原则(除非您自己已经用尽了资源)。请按照更多说明进行解释detail@AnkitAgarwal这是我想要的“as”属性的解释