lagogz
(Lagocamanho)
1
Good afternoon.
I’ve the default Yii structure for layouts:
main.php
column1.php
column2.php
I need a left menu that is displayed if the user is logged.
-
If I add this menu to column2.php, not shown is I use column1.php.
-
If I add this menu to main.php, the appearance of the page changes.
Would I have to create another layout and put there? How I can do that?
I don’t understand how to launch the action to load the menu if I create other layout.
It could be in SiteController.php overriding beforeAction?
Regards!
konapaz
(Konapaz)
2
Hi lagogz
first of all I didn’t understand the phrase
"If I add this menu to column2.php, not shown is I use column1.php."
You have to use column2 to show your menu. If you do not want the menu in other cases then set a condition for that like
if(!Yii::app()->user->isGuest) {
$this->menu=array(
array('label'=>'menu1', 'url'=>array('index')),
array('label'=>'menu2', 'url'=>array('index2')),
);
} else {
$this->menu= array();
}
lagogz
(Lagocamanho)
3
Thanks for reply, KonApaz.
I don’t understand that phrase neither…jejejejeje.
I did something similar.
I put the menu in main.php with this condition and I modified the CSS and ready.
Regards.