On Mon, 01 Mar 2010 07:18:07 +0800, Dasn wrote:
Hi guys, I'm trying to control the ErrorController via turning
on/off the 'displayExceptions' in a controller, for example:
class ViewController extends Zend_Controller_Action
{
public function init()
{
/* Initialize action controller here */
$front=$this->getFrontController();
$front->setParam('displayExceptions', 0);
}
}
I found the value of 'displayExceptions' was changed, but did not
have any effects. Any idea to archive this?
Thanks.
Well I finally achieved this. As the controller is already in the
dispatching stage, to setParam() to the frontController is too late. The
right way I think, is to talk to the Dispatcher. Here's the code:
class ViewController extends Zend_Controller_Action
{
$front = $this->getFrontController();
$front->getDispatcher()->setParam('displayExceptions', 0);
throw new Zend_Controller_Action_Exception("Test exception,
shouldn't be seen");
}
--
Dasn