views:

101

answers:

2

On zend framework inside my bootstrap file i have the following code:

$frontController = Zend_Controller_Front::getInstance(); 

try 
{
    $front->dispatch();
} 
catch (Exception $e) 
{
    echo "Something wrong happen";
}

Instead the ugly message i want to redirect to a custom controller... how can i do that if i can not use $frontController to redirect .... ?

Thanks for your help..

+1  A: 

Zend will redirect to ErrorController if it is set.

By default, Zend_Controller_Plugin_ErrorHandler will forward to ErrorController::errorAction()

See Section 12.10.5.2.

Byron Whitlock
+1  A: 

ZendFramework has a helper class for handling redirects.

Sample usage (from your controller):

$redirectHelper = $this->_helper->getHelper('Redirector');
$redirectHelper->gotoUrl('controller/action');

You can also call redirect directly from your controller, i.e.

$this->_redirect($url);
Mark Basmayor