设置数据:
<block type="obishomeaddon/customcategory" name="customcategory" template="homeaddon/customcategory.phtml">
<action method="setData"> <name>column_count</name> <value>4</value> </action>
<action method="setData"> <name>category_id</name> <value>116</value> </action>
</block>
获取数据:
class Block extends Mage_Core_Block_Template {
public getColumnCount() {
return $this->getData('column_count');
}
public getCategoryId() {
return $this->getData('category_id');
}
}
但我看到 Magento 可以做这样的事情:
<block type="obishomeaddon/customcategory" column_count="4" category_id="116" name="customcategory" template="homeaddon/customcategory.phtml"/>
如何从这种设置数据中设置属性值?