Saturday, February 21, 2015

call static block in magento

You can call static blocks by using following ways:
1) In CMS page or block:
{{block type="cms/block" block_id="custom_block_id"}}

2) In PHP code:
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('custom_block_id')->toHtml(); ?>

3) In XML file:
<block type="cms/block" name="custom_block_id" after="-">
      <action method="setBlockId"><block_id>custom_block_id</block_id></action>
</block>

No comments:

Post a Comment

Fatal error: Class Zend\Stdlib\Parameters contains 1 abstract method... magento 2

Fatal error: Class Zend\Stdlib\Parameters contains 1 abstract method and must therefore be declared abstract or implement the remaining met...