Adding a Static Block to your .phtml files in Magento
1. Create 1 CMS Static Block at CMS/Static Block /Add new Block
2. Call a Static Block to your .xml files in Magento: Go to your .xml file in your Magento template’s LAYOUT folder. Just paste this code:
<block type="cms/block" name="cms_test_block" before="-">
<action method="setBlockId"><block_id>cms_test_block</block_id></action>
</block>
You can call it by it’s name in file .phtml
<?php echo $this->getChildHtml('cms_test_block') ?>
3. Call a Static Block to your .phtml files in Magento: Go to your .phtml file, where you would like that static block to appear, then paste this code:
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId(cms_test_block)->toHtml() ?>
No comments:
Post a Comment