我在让自定义引用 block 在 Magento 中工作时遇到一些问题。
这些是我已采取的步骤:
第 1 步
在 page.xml 中创建了一个新的“引用” block
<block type="core/text_list" name="newreference" as="newreference"></block>
第 2 步
在我希望它出现在页面中的位置添加了对此 block 的引用(1column.phtml、2columns-left.phtml、2columns-right.phtml、3columns.phtml 中的页脚上方)
<?php $this->getChildHtml('newreference'); ?>
第3步
添加了对catalog.xml的引用,它告诉Magento我想在类别页面的“newreference”引用 block 中输出模板部分(specialfooter.phtml)
<reference name="newreference">
<block type="core/template" name="specialfooter" template="page/html/specialfooter.phtml"></block>
</reference>
第 4 步
在 page/html/目录中创建“specialfooter.phtml”,并使用一个简单的段落 block 进行测试。
什么也没发生。
我所采取的步骤符合我对引用 block 如何工作的理解,但我可能是错的。我正在努力寻找任何官方或其他文件,或任何以前的 SO 问题来阐明该主题。
我正在使用 Magento 版本。 1.7.0.2。
任何帮助将不胜感激。
最佳答案
你没有忘记echo
吗? :
<?php echo $this->getChildHtml('newreference'); ?>
关于magento - 向 Magento 添加新的引用 block ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13043859/