如果我有像
这样的xml结构,如何调用phtml文件中子块中定义的函数<block
type="test_test/adminhtml_customer_edit_tab_giftregistry"
name="tab_test_main"
template="test/test/customer/main.phtml">
<block
type="test_test/adminhtml_customer_edit_tab_giftregistry_list"
name="tab_test_list"
as="giftregistry_list"/>
</block>
我想调用&#34; adminhtml_customer_edit_tab_giftregistry_list&#34;中定义的函数。阻止
答案 0 :(得分:3)
创建一个子块对象并调用该函数,如下所示:
$myblock = $this->getLayout()->getBlock('myblock');
echo $myblock->mymethod();
在你的模块中:
$listblock = $this->getLayout()->getBlock('test_test/adminhtml_customer_edit_tab_giftregistry_list');
echo $listblock->yourmethod();
干杯: - )