Wednesday 3 August 2011

Magento Referencing a Static Block in a *.phtml file

use this snippet of code replacing 'IDENTIFIER' with the ID of your Static Block:

<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('INDENTIFIER')->toHtml() ?>

Reference in XML

XML Ref
<block type="cms/block" name="**REFERENCED IN phtml**">
<action method="setBlockId"><block_id>**STATIC BLOCK ID**</block_id></action>
</block>
phtml Ref
<?php echo $this->getChildHtml('**REFERENCED IN phtml**') ?>

click here for the original website

No comments:

Post a Comment