我在我的2columns-right中使用以下代码。调用Mangento管理面板中创建的堆栈块到产品页面:
<?php echo $this->getChildHtml('right') ?> <?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('recipes')->toHTML(); ?>
我也有这个代码在我的目录。xml:
<reference name="right">
<block type="cms/block" name="recipes">
<action method="setBlockId"><block_id>recipes</block_id></action>
</block>
</reference>
页面上没有显示任何内容。我已经回显了一些虚拟文本,并呈现在正确的位置,所以我知道有正确的。php文件,但我没有得到块的迹象。
create local.xml
under app/design/frontend/your package/your template/layout/
并输出下面的代码
<?xml version="1.0"?>
<layout version="0.1.0">
<default>
<reference name="right">
<block type="cms/block" name="recipes" before="cart_sidebar" output="toHtml">
<!--
The content of this block is taken from the database by its block_id.
You can manage it in admin CMS -> Static Blocks
-->
<action method="setBlockId"><block_id>recipes</block_id></action>
</block>
</reference>
</default>
也检查cms块是否为exiting or not in admin and also check store select or not
。如果multi store exit