Magento: Render static block in a phtml file

Magento: Render static block in a phtml file

Suppose you have created a static block from Magento administration panel (CMS -> Static Blocks) and you want to render its content in some phtml file.

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

Above code will load the static block by its identifier “footer_links”, then produces and returns block’s html output.

Author: Tahir Yasin

Tahir is a Passionate Web Developer from Lahore, Pakistan and a guy with NEVER-STOP-LEARNING attitude who keeps an eye on emerging technologies and customer trends.

1 thought on “Magento: Render static block in a phtml file”

  1. Hey There. I found your blog the usage of msn. This is a very neatly written article.
    I will be sure to bookmark it and return to read more of your helpful
    information. Thanks for the post. I will certainly comeback.

Leave a Reply

Your email address will not be published. Required fields are marked *