我试图引用其他自定义模块中的 block 以通过布局文件添加子 block ,但它不起作用。
第一个布局文件包含
<catalog_product_view>
<reference name="content">
<block type="core/template" name="tabcontainer" as="tabcontainer"
template="store/tabcontainer.phtml" >
<block type="catalog/product_list_related" name="kitparts"
template="store/product/kitparts.phtml"/>
</block>
</reference>
</catalog_product_view>
在第二个中,我尝试引用 tabcontainer
block
<catalog_product_view>
<reference name="tabcontainer">
<block type="productshippinginfo/productshipping" name="productshippinginfo"
template="productshippinginfo/productshipping.phtml" after="kitparts"/>
</reference>
</catalog_product_view>
但是productshippinginfo
block 不会显示,但它肯定包含在布局中(使用 Alan Storm 的布局查看器插件)。如果我引用content
已显示。
出了什么问题?是否可以从自定义扩展将子项添加到自定义 block ?
感谢您的帮助!
(我使用的是 Magento 1.6.1.0)
[编辑]
在 tabcontainer.phtml 中,我正在调用 <?php echo $this->getChildHtml(); ?>
最佳答案
首先:谢谢Vinai !
添加依赖项来控制插件的加载顺序,它有效!
在文件:app/etc/modules/Company_ContentModule.xml
<Company_ContentModule>
<active>true</active>
<codePool>local</codePool>
<depends>
<Company_ContainerModule />
</depends>
</Company_ContentModule>
因此内容模块是在容器模块之后加载的。
关于Magento:引用自定义 block 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8328491/