How can I load errors and exceptions under layout?

Actually, Yii shows errors and exceptions on a blank page with the informations.

But I want tho change this, and show this information under my layout, show error/exception under the content of main page.

My idea was to inherit CErrorHandler and override render method to seem like the CController->render method. However, the last method requires so many proper functions (of the CController class) to work.

Is there an easier method to do that?

Please check  this:…s/detail?id=300

It will be available in 1.0.6.

Thanks, Qiang!!

I was just about to ask the same question. Thank you Qiang.

Thanks Qiang! Now this is working like a charm! ^^

*PS: Suggestion for the guide:

Where is

$this->render('error', $error);

Change to

$this->render('error', array("error" => $error);


$this->render('error', array("data" => $error);

Using the guide approach, you can access $code, $message, etc. directly in your view. Otherwise, you would have to use $error['code'], $error['message'].

absolutely Right! I have to pay more attention :P