Magento - cms/static blocks


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. Load block in template file
  2.  
  3. <?php
  4. $blockID = 'myblock-identifier';
  5. $block = $this->getLayout()->createBlock('cms/block')->setBlockId($blockID)->toHtml();
  6. ?>
  7.  
  8.  
  9. Load block in XML
  10.  
  11. <reference name="left">
  12. <block type="cms/block" name="sample_block">
  13. <action method="setBlockId"><block_id>sample_block</block_id></action>
  14. </block>
  15. </reference>
  16.  
  17.  
  18.  
  19. Load block in CMS
  20.  
  21. {{block type="cms/block" block_id="my_block" template="cms/content.phtml"}}

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.