To call a static block in Magento, Following single line will solve your problem,
<?php getLayout()->createBlock('cms/block')->setBlockId('my_static_block_name')->toHtml() ?>
Definitely we’ll write this line in some .phtml file for which you want to call this block …
Hope this tip will be helping for someone 😉
Advertisements
Nice tutorial. I wrote one similar with a few extra ways to access static blocks.
http://fishpig.co.uk/2010/04/14/accessing-static-blocks-in-magento/
Hope it helps 🙂
Actually it’s
getLayout()->createBlock(‘cms/block’)->setBlockId(‘my_static_block_name’)->toHtml() ;
?>
I ment echo end this is missing.
Nice post, I was searching for this code.I got it.thanks for sharing.