向Magento添加新的参考块

joh*_*514 6 magento magento-1.7

我在使用自定义参考块在Magento中工作时遇到了一些麻烦.

这些是我采取的步骤:

步骤1

在page.xml中创建了一个新的"引用"块

<block type="core/text_list" name="newreference" as="newreference"></block>
Run Code Online (Sandbox Code Playgroud)

第2步

在我希望它出现在页面中的位置添加了对此块的引用(在1column.phtml中的页脚上方,2columns-left.phtml,2columns-right.phtml,3columns.phtml)

<?php $this->getChildHtml('newreference'); ?>
Run Code Online (Sandbox Code Playgroud)

第3步

添加了对catalog.xml的引用,告诉Magento我想在类别页面的'newreference'参考块中输出模板部分(specialfooter.phtml)

<reference name="newreference">
     <block type="core/template" name="specialfooter" template="page/html/specialfooter.phtml"></block>
</reference>
Run Code Online (Sandbox Code Playgroud)

第4步

在页面/ html /目录中创建'specialfooter.phtml',并使用一个简单的段落块进行测试.

没有任何反应.

我采取的步骤符合我对Reference块如何工作的理解,但我可能是错的.我正在努力寻找任何官方或其他方面的文件,或任何先前的SO问题,这些问题可以解释这个问题.

我正在使用Magento ver.1.7.0.2.

任何帮助将非常感激.

Cét*_*tia 6

难道你没忘记echo?:

<?php echo $this->getChildHtml('newreference'); ?>
Run Code Online (Sandbox Code Playgroud)