Can I specify a layout for system views?

Can I specify a layout for system views?

I'm guessing no since they aren't controller actions.

…but I can turn it into one by executing

<?php echo Yii::app()->runController('site/error404'); ?>


This is an intelligent approach! But be aware that your error404 action and the site layout views do not cause problem.

Maybe it will be good to have the option to create a controller to execute the actions.

For example:

class CErrorHandlerController extends CController {

    public $useLayout = false;

    public function actionerror($errorno){

         if ($this->useLayout){






    public function actionerror404(){



..... // All other Errors


And then call the error within this controller.

The render also must check if the view exists.

The controller is selected by the user in the configuration and could be extended by the user to create random behavior.