Disable layout and view render

2

Posted in Zend Framework | February 18, 2010

These are two simple lines that help you to disable layout and view render for a specific action:

public function indexAction()
{
  $this->_helper->layout()->disableLayout();
  $this->_helper->viewRenderer->setNoRender(true);
}

If you want switch off them for all actions of controller put these lines into preDispatch() method:

public function preDispatch()
{
  $this->_helper->layout()->disableLayout();
  $this->_helper->viewRenderer->setNoRender(true);
}