Get HTML from Magento CMS Block


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

Adding HTML into custom blocks rather than hard coding makes it so people don't bother us devs to change sheite!


Copy this code and paste it in your HTML
  1. <?php
  2. $layout = $this->getLayout();
  3.  
  4. if (!$layout ) {
  5. $layout = Mage::app()->getLayout();
  6. }
  7.  
  8. echo $layout->createBlock('cms/block')->setBlockId('whatever_custom_id')->toHtml();
  9.  
  10. ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.