Return to Snippet

Revision: 41018
at February 10, 2011 22:38 by alexmargineanu


Updated Code
Load block in template file

<?php
$blockID = 'myblock-identifier';
$block = $this->getLayout()->createBlock('cms/block')->setBlockId($blockID)->toHtml();
?>
 

Load block in XML

<reference name="left">
    <block type="cms/block" name="sample_block">
        <action method="setBlockId"><block_id>sample_block</block_id></action>
    </block>    
</reference>



Load block in CMS

{{block type="cms/block" block_id="my_block" template="cms/content.phtml"}}

Revision: 41017
at February 10, 2011 22:37 by alexmargineanu


Initial Code
Load block in template file

<?php
$blockID = 'myblock-identifier';
$block = $this->getLayout()->createBlock('cms/block')->setBlockId($blockID)->toHtml();
?>

 
Load z-block in template file

<?php
$block = $this->getLayout()->createBlock('zblocks/block')->setBlockPosition('custom')->setPosition('id')->toHtml();
?>

 

Load block in XML

<reference name="left">
    <block type="cms/block" name="sample_block">
        <action method="setBlockId"><block_id>sample_block</block_id></action>
    </block>    
</reference>


Load z-block in XML

<block type="zblocks/block" name="block_name">
<action method="setPosition">
<position>position_name</position>
</action>
</block>

 

Load block in CMS

{{block type="cms/block" block_id="my_block" template="cms/content.phtml"}}
{{block type="cms/block" block_id="my_block"}}


Load z-block in CMS

{{block type="zblocks/block" position="my_block"}}

Initial URL


Initial Description


Initial Title
Magento - cms/static blocks

Initial Tags
magento

Initial Language
PHP