[SOLVED] Error page in module using default layout

My module using it’s own layout(I added $this->layout = ‘main’; in TestModule.php) but 404 error page still using layout from main site.

How can I fix this?


yii version: 1.1.10

a couple of things:

  1. make sure that main.php exists under protected/modules/modulename/views/layouts

  2. define the layout path example:


hope this helps

  1. It is)

  2. Didn’t help…

mm actually $this->layout = ‘main’; - didn’t help either, before I change in Controller.php

public $layout=’//column1’; to

public $layout=‘column1’;

(read it somewhere)

Even tried to extend my module controller from CController instead of Controller - didn’t help either.

In your view just write

$this->layout = "column1";

And for the column1 file should be right this:

<?php $this->beginContent('..//layouts/main'); ?>

Solved it!

in config/main.php there is


			// use 'site/error' action to display errors



I changed it to ‘errorAction’=>‘error’, and define actionError in my module controller.