How to add Static block directly into your template file (.phtml)

Posted by Labels: at

Here is a short php code to help you display Static Block that you created on your Magento Admin panel.


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



Looking at the above code you will notice setBlockId('social-connect')  'social-connect' is my Static Block Identifier name or BlockId, that I used when I was creating my static block.


Note: You can use this php code on any template file (.phtml).

I hope this article was helpful to you, please leave your question/s on the comments section below and I will do my best to answer back.


Post a Comment

Back to Top