Yii Framework Forum: Multiple Main Layout, possible? - Yii Framework Forum

Jump to content

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

Multiple Main Layout, possible? Rate Topic: -----

#1 User is offline   junxiong 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 541
  • Joined: 21-June 10

Posted 21 June 2010 - 04:11 AM

Hello all. I am still learning Yii framework and there is something I wanna ask. If I want to create a back-end website that have a different main layout with the front-end one, what should I do?
Must I create a new project as the back-end site. Or are there any way to select certain "main layout" for certain view.. ?
Thanks before...:)
“The most likely way for the world to be destroyed, most experts argue, is by accident. That’s where we come in; we’re computer professionals. We cause accidents.” - Nathaniel Borenstein

Yii Playground : Collaborative demo apps. You can join to improve it too!
My Team's Blog: In Indonesian.
0

#2 User is offline   Spyros 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 461
  • Joined: 14-April 09
  • Location:Athens - Greece

Posted 21 June 2010 - 04:16 AM

Check the $layout attribute in the controller class. You can set a different layout for the admin's Controllers and another one in the user's controllers
0

#3 User is offline   junxiong 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 541
  • Joined: 21-June 10

Posted 21 June 2010 - 06:46 AM

View PostSpyros, on 21 June 2010 - 04:16 AM, said:

Check the $layout attribute in the controller class. You can set a different layout for the admin's Controllers and another one in the user's controllers


ah yes... But doesn't those only change the column layout? Meaning the content will put in to , say, views/layouts/column1.php but in the end it will also in the views/layouts/main.php. Because the front-end has already used the current views/layouts/main.php, I want to create something like main.php for the back-end, a template that different with the front-end one. :)
“The most likely way for the world to be destroyed, most experts argue, is by accident. That’s where we come in; we’re computer professionals. We cause accidents.” - Nathaniel Borenstein

Yii Playground : Collaborative demo apps. You can join to improve it too!
My Team's Blog: In Indonesian.
0

#4 User is offline   mech7 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 220
  • Joined: 26-March 09

Posted 21 June 2010 - 06:59 AM

Add backend.php and set layout to backend
1

#5 User is offline   junxiong 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 541
  • Joined: 21-June 10

Posted 21 June 2010 - 08:41 AM

Ahh....you're right, Mech...
thank you very much :)

And I'd just noticed how the file of column1.php become attached in main.php. its because of
<?php $this->beginContent('application.views.layouts.main'); ?>
ahh... stupid me ~.~"
“The most likely way for the world to be destroyed, most experts argue, is by accident. That’s where we come in; we’re computer professionals. We cause accidents.” - Nathaniel Borenstein

Yii Playground : Collaborative demo apps. You can join to improve it too!
My Team's Blog: In Indonesian.
0

#6 User is offline   Junior - df9 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 416
  • Joined: 24-May 09
  • Location:Brazil

Posted 23 June 2010 - 05:38 AM

View Postjunxiong, on 21 June 2010 - 08:41 AM, said:

Ahh....you're right, Mech...
thank you very much :)

And I'd just noticed how the file of column1.php become attached in main.php. its because of
<?php $this->beginContent('application.views.layouts.main'); ?>
ahh... stupid me ~.~"



I think that this cookbook will help you
http://www.yiiframew...oc/cookbook/33/

I've been using this technique since I started with Yii and it brought me many advantages

You could also take a look at themes

:)

regards!
______________________________________
Junior
df9.com.br
Linux Registered User #364954
GNU/Linux: together we're ready!
0

#7 User is offline   junxiong 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 541
  • Joined: 21-June 10

Posted 23 June 2010 - 07:48 AM

Ah.. I see. Thank you for providing this.
Never found this cookbook. :)
“The most likely way for the world to be destroyed, most experts argue, is by accident. That’s where we come in; we’re computer professionals. We cause accidents.” - Nathaniel Borenstein

Yii Playground : Collaborative demo apps. You can join to improve it too!
My Team's Blog: In Indonesian.
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