In between Magento 1.x and 2.x, rendering the Static block is quiet different. You can call either in .phtml template, CMS page or layout file in the following way.
In phtml file:
1 |
<?php echo $this->getLayout()->createBlock('Magento\Cms\Block\Block')->setBlockId('block-identifier')->toHtml();?> |
In layout file:
1 2 3 4 5 6 7 |
<referenceContainer name="content"> <block class="magento\Cms\Block\Block" name="block-identifier"> <arguments> <argument name="block_id" xsi:type="string">block-identifier</argument> </arguments> </block> </referenceContainer> |
In any CMS block:
1 |
{{block class="Magento\Cms\Block\Block" block_id="block-identifier"}} |
Leave a Reply