There are two ways you can output static CMS blocks in Magento’s “.phtml” files.
Method 1. Using XML (Recommended)
Insert the following code inside the view block that you want it to be accessible in. In the example below I have inserted it into the “product.info” block in the “” layout handle. This can be found at : app/design/frontend/your_theme/default/layout/catalog.xml. If it is not there then you will need to copy it over from the base folder, this can be found at app/design/frontend/base/default/layout/catalog.xml.[cc lang=”xml”]
Then in your view script (catalog/product/view.phtml), the block will be accessible using :[cc lang=”php”] echo $this->getChildHtml(‘my_block’);
Method 2. Using View Script
With this method you will not need to edit any XML layout configuration as you are creating the block on the fly and then outputting it manually using the “toHtml” method of the “Mage_Core_Block_Abstract” class. This method gets called on all Magento view blocks that produce any kind of output.[cc lang=”php”] echo $this->getLayout()->createBlock(‘cms/block’)->setBlockId(‘my_block’)->toHtml();
As you can see both these methods do virtually the same thing, the reason I prefer using method one is because it allows Magento to cache the layout configuration, improving page load speeds etc.