Magento: How To Add Static Blocks
November 12th, 2011 | Posted by in Magento | SEO & Internet MarketingAdd a Static Block from a CMS Page :
First create the the static block. Lets say, the identifier you used is “my_block” Now goto your CMS page and paste this in the content box,
{{block type="cms/block" block_id="my_block"}}Then click on Design > Page Layout on the same CMS page edit screen. And paste this,
<reference name="content"> <block type="cms/block" name="my_block"> <action method="setBlockId"><block_id>my_block</block_id></action> </block> </reference>Thats all. Clear cache and you should be able to see your static block on frontend.
Add a Static Block from the PHTML file :
If you want to call a static blockĀ from a magento template file, the .phtml files, then here is how to do that. Just edit the .phtml file and place this code with your static block identifier,
<?php echo$this->getLayout()->createBlock('cms/block')->setBlockId('my_block')->toHtml() ?>You can follow any responses to this entry through the RSS 2.0 You can leave a response, or trackback.




