Yii Framework Forum: Multiple Default Layout? - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Multiple Default Layout? Rate Topic: -----

#1 User is offline   clonevn 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 111
  • Joined: 25-March 13

Posted 28 April 2013 - 02:09 AM

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?
0

#2 User is offline   sensorario 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,986
  • Joined: 07-September 10
  • Location:Cesena (Italy)

Posted 28 April 2013 - 02:44 AM

Take a look at column1.php or column2.php. These templates calls main.php:

<?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.
0

#3 User is offline   clonevn 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 111
  • Joined: 25-March 13

Posted 28 April 2013 - 02:58 AM

Thanks alot, it work correctly :).
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users