Basically, in Yii there is main.php that will render the main layout structure including header, sidebar, mainmenu, content section and footer. Other layouts called column1 or 2 just contain the view of content section in the main layout. But now Im bored with this main.php and would like to use another one. I create main1.php that put it in the layouts folder, so how can I set it as default layout or how can I use it as main layout? Can I use both main.php and main1.php?
Page 1 of 1
Multiple Default Layout?
#2
Posted 28 April 2013 - 02:44 AM
Take a look at column1.php or column2.php. These templates calls main.php:
So take your myNewMain.php. Create your own myNewColumn1.php with:
and in your controller set as default layout myNewColumn1.
<?php /* @var $this Controller */ ?> <?php $this->beginContent('//layouts/main'); ?> ... <?php $this->endContent(); ?>
So take your myNewMain.php. Create your own myNewColumn1.php with:
<?php /* @var $this Controller */ ?> <?php $this->beginContent('//layouts/myNewMain'); ?> ... <?php $this->endContent(); ?>
and in your controller set as default layout myNewColumn1.
Share this topic:
Page 1 of 1