How to display the CMS static blocks on a page in Magento

In Magento you can create CMS static block from Admin by following the path: Admin >> CMS >> Static Blocks.

Lets see how we can display them on the frontend.


1. Using Layout updates

You can add layout updates in local.xml file for a page as shown below:

<reference name="right">
     <block type="cms/block" name="your_block_name" before="-">
         <action method="setBlockId">

You can enter these layout updates in Magento admin also – Categories, Products, CMS Pages provide a field for ““.


2. Using .phtml files

In you .phtml files you can display the CMS static block using the code shown below:


echo $this->getLayout()->createBlock('cms/block')->setBlockId('your_block_identifier')                                                       ->toHtml();



3.Using Magento admin

If you want to display a CMS static block in a Magento CMS page then you can add information as shown below in the content area of the page in Magento admin.

{{block type="cms/block" name="your_block_name" before="-" block_id="your_block_identifier"}}

Leave a Comment

Back to top