Disable view in zend framework



In an application development we need to use ajax several times. So I decided to use a specific controller for all ajax uses. But I found an application error “‘ajax/gedata.phtml’ not found in” on every action of AjaxController. Then I came to know a solution for this problem. Disable view in zend framework.

To disable the layout you need to use

$this->_helper->layout->disableLayout();

To set no render

 $this->_helper->viewRenderer->setNoRender(); 

you can use these in action of your controller or if you want to disable view for all action of controller just add these line to init() function of you controller.

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

Hope this will help you also.