call a phtml file from controller in magento

Hello Friends

If you want to call phtml file from controller in magento then use my below script

<?php
class Namespace_Module_DisplayController extends Mage_Core_Controller_Front_Action
{
public function popupAction()
{
$block = $this->getLayout()->createBlock('core/template')
->setTemplate('zipcode/popup.phtml');
$this->getResponse()->setBody($block->toHtml());
}
}
?>

0 comments:

Post a Comment