Home » Magento

Magento: How to call static block from template file?

4 December 2009 Share/Bookmark

You can easily call any static block from template (phtml) file. At first, you have to create a static block.

Let us suppose, you created a static block with the identifier cool_items.

Now, you can call the static block from any phtml file with the help of following code:


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

From Mukesh Chapagain's Blog, post Magento: How to call static block from template file?

email

php magento mukesh chapagain

Get New Post by Email
RSS Feed Subscribe RSS Feed
  • Wouter

    Thank you so much for this! I could not get it to work but with this code it does :-)

  • Puja Sinha

    Thank You.
    This code really helped

  • http://modraideja.com modra ideja

    tnx, nice and simple :)

  • http://www.justwebdevelopment.com/ Merk

    You are so awsoeme for helping me solve this mystery.