如何在phtml模板中调用Magento块? [英] How to call Magento block in phtml template?
本文介绍了如何在phtml模板中调用Magento块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要在页脚中显示更多链接.我在magento admin中将这些链接创建为静态块(id = sample_links).
i need to display some more links in footer. i created those links in magento admin as static blocks (id = sample_links ).
然后我添加了以下代码page.xml文件
and then i added following code page.xml file
<reference name="foot_lnk">
<block type="cms/block" name="sample_block" before="-">
<action method="setBlockId"><block_id>sample_links</block_id></action>
</block>
</reference>
我在footer.phtml中称其为
i called this one in footer.phtml as,
<?php echo $this->getChildHtml('foot_lnk') ?>
,但不显示CMS静态块内容.有什么问题?.
but it does not display the CMS static block content. what is the issue?.
推荐答案
引用是先前定义的您希望您的块位于其中的块,例如:
The reference is the block previously defined that you want your block to be inside, e.g.:
<reference name="footer">
<block type="cms/block" name="sample_links">
<action method="setBlockId"><block_id>sample_links</block_id></action>
</block>
</reference>
然后
<?php echo $this->getChildHtml('sample_links') ?>
这篇关于如何在phtml模板中调用Magento块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文