Friday 29 January 2016

How to display static block with title in phtml file : Magento

If you want to display static block in PHTML file in Magento. We can use following code:


<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('identifier')->toHtml() ?>



But If you want to display static block with title. So, we can you following code:


<?php
     $block = Mage::getModel('cms/block')--->load('identifier');
     echo $block->getTitle();
     echo $block->getContent();
?>


5 comments:

  1. Its good to know about static block with title, very informative and pretty well maintained. Thanks for this post, keep updating.
    Hot Rolled Coil Supplier In Delhi

    ReplyDelete
  2. This post is all about the static block with title file in magento. This is a very informative and pretty well maintained.
    knuckle and elbow whitening cream

    ReplyDelete
  3. This post is really pretty impressive, thanks for it.
    uboard

    ReplyDelete