Answer Posted / Prashant Sagar
To include a CMS block in a template file (.phtml), follow these steps:
1. Navigate to Content > Blocks in the Magento admin panel and create a new static block or edit an existing one.
2. In the Identifier field, enter a unique identifier for the block (e.g., header_banner).
3. Fill out the other required fields as needed and save the block.
4. In your template file (.phtml), use the following code to include the CMS block:
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('header_banner')->toHtml(); ?>
5. Replace 'header_banner' with your CMS block identifier.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers