Hello,
still try to find the ‘best’ solution for my menu.
I want to have a two row horizontal menu with a third level as a vertical pull down menu.
I want to use only CMenu, not an extensions like MbMenu.
To bring it in the ‘right direction’ like horizontal or vertical and so on, I will use CSS, that’s not a problem. I always did it in classic php apps.
My “classic php” solutions looks like:
-
Menu_Item_1
-
Menu_Item_2
-
Menu_Item_3
And if the selected Item is ‘Menu_Item_2’ I add the following.
- Sub_Menu_Item_1
-
Sub_Menu_Item_2
-
Sub_Menu_Item_3
The Output is:
Menu_Item_1 Menu_Item_2 Menu_Item_3
Sub_Menu_Item_1 Sub_Menu_Item_2 Sub_Menu_Item_3
and is formatted via CSS. => ok
So, when I use yii’ CMenu I do the following:
$this->widget(‘zii.widgets.CMenu’,array(
'items'=>array(
array(…Menu_Item_1..)
array(…Menu_Item_2., items Sub_Menu_Item_1, Sub_Menu_Item_3, Sub_Menu_Item_3) // Sub_Menus
array(…Menu_Item_3..)
so I get instead of the described ‘classic php’ solution the following:
Menu_Item_1 Menu_Item_2
Sub_Menu_Item_1 Sub_Menu_Item_2 Sub_Menu_Item_3
Menu_Item_3
That is a difference and not simple to solve with CSS (in my opinion)
I could solve it by calling the widget twice:
$this->widget(‘zii.widgets.CMenu’,array(
'items'=>array(
array(…Menu_Item_1..)
array(…Menu_Item_2. ..)
array(…Menu_Item_3..)
$this->widget(‘zii.widgets.CMenu’,array(
'items'=>array(
array(…Sub_Menu_Item_1..)
array(…Sub_Menu_Item_2. .)
array(…Sub_Menu_Item_3..)
That brings me the right structure:
Menu_Item_1 Menu_Item_2 Menu_Item_3
Sub_Menu_Item_1 Sub_Menu_Item_2 Sub_Menu_Item_3
Is this solution ok? Or is there another idea to solve it ?
I have more (specific) questions, depends on the solution :rolleyes: