mudule and view layout

Hello,

I am new to framework (only a few days of playing around). I got a bot confused how layouts work. I hope you

guys can help me out.

I have my main site setup and under it I created a module I added following to config file:

‘modules’=>array(

       'adminTest'=>array('layout'=>'admin')


    ),

Under modules/adminTest/views/layouts I created a modified copy of the main.php of the main site layout.

in index.php under module I added following code:

<p>

Layout Path &lt;?php echo &#036;this-&gt;module-&gt;layoutPath ?&gt; &lt;br/&gt;


Layout &lt;?php echo &#036;this-&gt;module-&gt;layout ?&gt;

</p>

the output looks like:

Layout Path {removed}/protected/modules/adminTest/views/layouts

Layout admin

but the page still uses main.php layout form main site. What am I missing?

I am using code from svn 1.1.3-dev

thanks in advance for any idea you can give me. I feel like I am stuck. I want to keep module related

layout within that module

$this->layout = "admin";

$this->render(‘index’);

try in your action!

that did worked! Do I have to init this in each action for each comptroller? How come the global property

did not work? Does controller have a init routine that executed before each action that I can use?

Yes of corse you can.

Instead of writing


$this->layout = "admin";

in the action you can use


public $layout='admin';

at top of your class.

If all your controllers in a module have to share some properies, you can set them in AdminTestModule::beforeControllerAction

but why the module property does not get propagated to the controller level? According to doc it should.

Also if action ‘a’ will have ‘public $layout= ‘admin’’ and I am actually activating action b then my init

will never gets hit?