Posted By

Savio on 10/30/10


Tagged

php xml magento


Versions (?)

Magento: Inserting Static Block in Magento Templates


 / Published in: XML
 

  1. /* There are three ways to insert static blocks into magento templates */
  2.  
  3. /* 1.Inserting into example-template.phtml */
  4.  
  5. <?php
  6. echo $this->getLayout()->createBlock('cms/block')->setBlockId('MyCustomCMSPage')->toHtml() ;
  7. ?>
  8.  
  9.  
  10. /* 2. Inserting into CMS */
  11.  
  12. {{block type="cms/block" block_id="MyCustomCMSPage" template="cms/example-template.phtml"}}
  13.  
  14. /* 3. Inserting into layout.xml */
  15.  
  16. <layout>
  17. <example>
  18. <reference name="content">
  19. <block type="cms/block" name="cms_store_check">
  20. <action method="setBlockId"><block_id>MyCustomCMSPage</block_id></action>
  21. </block>
  22. </reference>
  23. </example>
  24. </layout>

Report this snippet  

You need to login to post a comment.