Prevent a view rendering with the Zend Framework
Posted June 25th, 2009 in PHP
The front controller of the Zend Framework will render a view by default but it's possible to disable this automatic rendering should you need to, for example if making an Ajax call which sends some JSON data instead of an HTML template.
In the action simply add the following line of code and it will not render the view:
$this->_helper->viewRenderer->setNoRender(true);
Related posts:
- Using the Zend_Registry in PHP (Monday, January 19th 2009)
- Method chaining with PHP (Sunday, December 7th 2008)
- Sending email with Zend_Mail (Saturday, August 23rd 2008)
- Database error handling with the Zend Framework (Sunday, May 11th 2008)
- Zend Framework Controller Router example (Saturday, April 12th 2008)

Comments
blog comments powered by Disqus