How to add static block to your phtml in Magento January 31, 2012
Static Block plays a big role in magento to show the information, links, banner etc. on the Magento sites. All the website developer use static block in a different manner. below is the process to add static block in your phtml file (Magento Theme File). 1) First login into magento admin and create a static block. You will find some mandatory fields there like Name, Identifier etc. For example we use "myblockname" in "Identifier Field". 2) Once you will create Static Block, You have to put some code in Layout and phtml file. 3) Open you layout xml file where you want to show the static block and put the below code there.
- <block type="cms/block" name="myblockname">
- <action method="setBlockId"><block_id>myblockname</block_id></action>
4) Not Open Your phtml file and put the below code
- <?php echo $this->getChildHtml('myblockname') ?>
5) Upload all the files and refresh the cache. It should be work now. --