[Magentp] How to call Magento block in phtml template?

xml

<reference name="foot_lnk">  
<block type="cms/block" name="sample_block" before="-">
      <action method="setBlockId"><block_id>sample_links</block_id></action>
    </block>
</reference>

Phtml

<?php echo $this->getLayout()->createBlock(‘cms/block’)->setBlockId(‘banner-freeshipping’)->toHtml() ?>

 

or put this code in Layout Update XML

<reference name=”right”>
<block type=”cms/block” name=”left.permanent.callout”> <action method=”setBlockId”>
<block_id>27</block_id></action> </block>
</reference>

댓글 남기기