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

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

[code language=”php”]
<?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();
?>
[/code]

Search within Codexpedia

Custom Search

Search the entire web

Custom Search