Magento – Insert Static Block in Magento Templates

There are basically three ways to insert static blocks into magento templates

1.Inserting into template-file.phtml

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

2. Inserting into CMS

{{block type="cms/block" block_id="CMS-block-id" template="cms/example-template.phtml"}}

3. Inserting into layout.xml

<layout>
    <example>
    <reference name="content">
     <block type="cms/block" name="cms_store_check">
     <action method="setBlockId"><block_id>CMS-block-id</block_id></action>
     </block>
     </reference>
     </example>
</layout>

One thought on “Magento – Insert Static Block in Magento Templates

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s