How to call any template inside phtml file magento
Posted by navaneeth on May 4, 2013 in Magento, Php | No comments yet
Sometimes you want to call a block inside a .phtml file without defining in layout. In this case, we can use a method called toHtml of a block.
Assume that we have a block called Mymodule and a template that is located at: mymodule/myblog.phtml
So to generate that block we use:
<?php echo $this->getLayout()->createBlock('mymodule/myblock')->setTemplate('mymodule/myblock.phtml')->toHtml(); ?>
Leave a Reply