2 layout/main.php files

Hi all,

I have to make a website with a splash screen and then when entering in the website standard pages…

I wonder how to achieve this with the Yii layout system.

The splash screen needs very few things, whereas other pages require the menu etc … as it is designed in layout/main.php

Choosing between column1.php or column2.php seems to be the only liberty we have.

The thing I would like to reach is in the controller (dealing with the splash) to set the right main.php, but it seems impossible.

I create layout/main-splash.php and I do this:


Yii::app()->layout='main-splash';

But always the layout/main is applied

Do you have ideas ?

Thanks

You can set CController::layout for a specific action.

http://www.yiiframework.com/doc/api/1.1/CController/#layout-detail




public function actionSplash()

{

    ...

    $this->layout = 'main-splash';

    // $this->layout = false; // if you don't need layout

    $this->render('splash');

}



Thanks works great

I do

public $layout=‘splash’; in the siteController