Disable layout and view renderer in Zend Framework

Just a quick tip: I’m working on a project using Zend Framework and needed to switch off layout and view renderer for a specific controller. This can be achieved by adding the following calls to the controller’s preDispatch() method:

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