How to add static block to your phtml in Magento

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.
  1. <block type="cms/block" name="myblockname">
  2. <action method="setBlockId"><block_id>myblockname</block_id></action>
  3. </block>
4) Not Open Your phtml file and put the below code
  1. <?php echo $this->getChildHtml('myblockname') ?>
5) Upload all the files and refresh the cache. It should be work now. -- Thanks  

Related Posts

from my blog


How To Reset Admin Password in Magento

January 20, 2017

As an ecommerce website developer or magento website developer, sometime we  get the a situation when we forget the magento website admin access detail. To reset the password of any...

How to show all attribute after layered navigation filter in Magento

April 10, 2015

Magento Layered Navigation is really good for filter the product but problem is that, if we select any attribute like color or price all other attribute hide which are not...

How to fix layered navigation filer URL in Magento?

April 2, 2015

Magento is really good eCommerce CMS in terms of functionality. Layered Navigation is really good feature of Magento to filter the product in frontend side. Only problem with the layered navigation filter...