Monday, April 25, 2011

Including static block in phtml file

During all my time of magento development and answering the forum posts, the trick which can be very useful during development is that how to include the static block in your phtml file. Having that can be very handy and useful as static block provides the cms page where the user can enter anything without writing the codes even including the widget. So heres the code that can be used to call the static block in the any desired phtml file.
getLayout()->createBlock('cms/block')->setBlockId('your_block_identifier')->toHtml() ?>
Hope this helps. Enjoy magento.

No comments:

Post a Comment