Call a block directly without define it in the layout file in Magento

Call a block directly without define it in the layout file.

<?php 
/*Gets the layout, creates the block, sets the template and parses it to html*/
echo $this->getLayout()->createBlock('socialwidget/twitter')->setTemplate('socialwidget/newblock.phtml')->toHtml(); 
?>

Search within Codexpedia

Custom Search

Search the entire web

Custom Search