I need to add static block which I created from back end to specific pages like user dashboard, login page. Is this possible?

3 Answers 3


use this where ever you want

call your .phtml file

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

Yes, it si possible there are two methods

using phtml

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

or using xml

<block type="cms/block" name="layout-name" before="-">
  <action method="setBlockId"><block_id>id-of-cms-block</block_id></action></block>


  • I need to add this block to top of the page. Like header
    – Dushan
    Nov 3, 2015 at 11:25
  • in this case you should use the xml version and add it int the <reference name="header"> session of you local.xml (please refer to the page.xml for further reference. Or you can take the short path and add the createBlock... instruction in your header.phmtl file
    – Giuseppe
    Nov 3, 2015 at 11:41

Just place this bit of code on the .phtml

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

Replace your-block-id with the block id that you wand to use.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.