Most Frequently Used Functions in Magento
- How to call static block from template file?
We can Easily call a static block directly from template.
Let us suppose, you created a static block with the identifier islbd_link.
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId(‘islbd_link’)->toHTML();?>
- How to call block directly from phtml file without defining in layout?
<?php echo $this->getLayout()->createBlock(‘newmodule/newblock’)->setTemplate(‘newmodule/newblock.phtml’)->toHtml(); ?>
- Add Static Block to CMS Page
{{block type=”cms/block” block_id=”home-page-promo”}}
- How to call a phtml file in magento cms page
{{block type=”core/template” name=”a-name” template=”cms/home.phtml”}}
- Magento Store – Get Base URL in Static Block
Try adding this to your static block:
<a href=”{{store url=”"}}”>Link to Base URL</a>
- Skin URL
<a href=”#”><img src=”{{skin url=’images/home/dog-playing.jpg’}}” alt=”"/></a>
- Get Url
<a href=”<?php echo $this->getUrl(‘about-us’)?>”>