layouts between modules problem

Hi there.

I have a main app with /layouts/main.php layout and a module named ‘admin’ in it with /layouts/main.php layout file. Problem is, when Im moving from main page localhost/avd/index.php/site to main page of admin the URL become like this localhost/avd/index.php/admin and I dont see layout specified in admin module, instead I see the “old” main layout. What is the reason?..

AdminModule.php




<?php


class AdminModule extends CWebModule

{

	public function init()

	{

		// this method is called when the module is being created

		// you may place code here to customize the module or the application


		// import the module-level models and components

		$this->setImport(array(

			'admin.models.*',

			'admin.components.*',

		));

                

                $this->layout='main';

	}


	public function beforeControllerAction($controller, $action)

	{

		if(parent::beforeControllerAction($controller, $action))

		{

			// this method is called before any module controller action is performed

			// you may place customized code here

			return true;

		}

		else

			return false;

	}

}




DefaultController.php //admin




<?php


class DefaultController extends Controller

{

	public function actionIndex()

	{

		$this->render('index');

                

	}

        

        

}



Controller.php //whole app




<?php


class Controller extends CController

{

	

	public $layout='//layouts/column1';

	

	public $menu=array();

	

	public $breadcrumbs=array();

}



snippet from /protected/config/main.php




...

'modules'=>array('admin', ...




The problem is, that your modules DefaultController extends Controller where the layout is set to

"//layouts/column1" = /protected/views/layouts/column1

// … means the applications view path

/ … means the modules view path

See documentation getLayoutFile

So try to set




public $layout='/layouts/column1'



in your admin DefaultController

or

see this topic for another solution.

Thanks a lot!