[Yii Framework] Error Handler for Modules
As we know, in Yii, we can set the error handler to display some useful message to the user.
But, when i want to display different views in different modules, how to do it?
Here is the way.
In your module, here let say we have a admin module, there is AdminModule.php in it,
then add the code as below:
public function init()
{
//other codes...
Yii::app()->setComponents(array(
'errorHandler'=>array(
'errorAction'=>'admin/default/error',
),
));
}
{
//other codes...
Yii::app()->setComponents(array(
'errorHandler'=>array(
'errorAction'=>'admin/default/error',
),
));
}
after that, we point the error handler to admin/default/error.
Have fun with Yii!