thezoulou
(Thezoulou)
June 19, 2009, 4:55pm
#1
Hi all !
How can I switch the whole application to another design?
I have two main designs. The user should be able to switch between the two.
I guess I need to modify the Application object. Something in that flavour?
Yii::App()->layout = 'myLayout'
qiang
(Qiang Xue)
June 19, 2009, 4:59pm
#2
Yes, that's right. You can do it in app config.
You may also consider using theme.
thezoulou
(Thezoulou)
June 19, 2009, 5:08pm
#3
But I need to modify the design dynamically
Does Yii::App() return the current instance of the application object?
thezoulou
(Thezoulou)
June 19, 2009, 5:11pm
#4
Ok… in the Doc, returns the application singleton.
Curious though, that the action to change the layout doesn't work.
qiang
(Qiang Xue)
June 19, 2009, 5:17pm
#5
It should work. you need to make sure you call this before render().
thezoulou
(Thezoulou)
June 19, 2009, 5:19pm
#6
Ok, I may have done something else wrong.
Thank you very much Qiang.
thezoulou
(Thezoulou)
June 19, 2009, 5:45pm
#7
The App() object remains unchanged…
public function actionLayoutChange() {
Yii::App()->layout = 'master2_map';
$this->redirect(array('list'));
}
jonah
(Poppitypop)
June 19, 2009, 7:30pm
#8
That only changed the layout for THAT REQUEST. When you redirect you move to a different request. You need to create a mechanism to remember the layout through different requests.
thezoulou
(Thezoulou)
June 19, 2009, 8:07pm
#9
Hi Jonah, thanks ! (of course, I'm stupid…)
Trying out