Add a static block to CMS page or PHTML (template) file

Submitted by deeperdata - 4 years ago

The first method calls a static block in CMS pages. The second method allows you to call a static block in PHTML files. Additional reference: http://stackoverflow.com/questions/8007555/how-to-add-a-cms-static-block-to-all-pages-in-magento

// Method 1
{{block type="cms/block" block_id="your-_block_id"}}

// Method 2
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('your_block_id')->toHtml(); ?>
affiliate_link
Learn PHP
comments powered by Disqus
Proudly hosted on Digital Ocean