Friday 3 April 2015

How to add static block call in phtml,xml and cms page in magento

How to add static block call in phtml,xml and cms page in magento


Hello Here sample code add static block in phtml,xml  and cms page.

In your Phtml File in magento


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

herer set i am setting my block

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

In your xml file

  <reference name="content">
    <block type="cms/block" name="home-page-block">
      <action method="setBlockId">add your block id
    </block>
  </reference>

In Your cms page

{{block type="cms/block" block_id="add your block id "}}

I hope this blog help you to add static block in your magento  any suggetion for me please comment it.


No comments:

Post a Comment

Thank You For Comment