Multilevel BootMenu

217 views
Skip to first unread message

akka

unread,
Sep 3, 2012, 12:01:07 PM9/3/12
to yii-bo...@googlegroups.com
I want to create multilevel BootMenu (I want to use 3 level).
For example, I use this code:

$this->widget('bootstrap.widgets.BootNavbar', array(
'fixed' => false,
'collapse' => true, // requires bootstrap-responsive.css
'items' => array(
    array(
        'class' => 'bootstrap.widgets.BootMenu',
        'items' => array(
            array('label' => 'Level 1', 'url' => '#', 'items' => array(
                    array('label' => 'Level 2', 'url' => '/'),
                    array('label' => 'Level 2', 'url' => '/'),
                    array('label' => 'Level 2', 'url' => '#', 'items' => array(
                            array('label'=>'Level 3', 'url' => '/'),
                array('label'=>'Level 3', 'url' => '/'),
                    )),
            )),
            array('label' => 'Level 1', 'url' => '#', 'items' => array(
                    array('label' => 'Level 2', 'url' => '/'),
                    array('label' => 'Level 2', 'url' => '/'),
                    array('label' => 'Level 2', 'url' => '/'),
            )),
      
            array('label' => 'Logout', 'url' => "/site/logout"),
        ),
    ),
),
));

But third level isn't rendering. Any suggestions?

Trejder

unread,
Oct 13, 2012, 9:05:46 AM10/13/12
to yii-bo...@googlegroups.com
Hm... Do you use newest version of Yii-Bootstrap extension? I don't know what is BootMenu, for building menus I use "bootstrap.widgets.TbMenu".

I copied your whole code to my project, and -- as I was expecting -- I've got exception saying that alias "bootstrap.widgets.BootMenu" is invalid.

Then I used my own "bootstrap.widgets.TbMenu" in that project, but only replaced structure (items array) to yours and I got perfectly rendered three level menu.

For first time I thought that using additional array (directly inside items array) was the problem. But not, menu displayed correctly only top item had no title.

That is all I can help you here... sorry!
Trejder

Christoffer Niska

unread,
Oct 13, 2012, 9:27:58 AM10/13/12
to yii-bo...@googlegroups.com
Hey Olga,

Try upgrading to 1.0.0 or newer and change the widget name to TbMenu as Trejder suggested. That should do the trick.

-Chris
--
Best regards,
Christoffer Niska
Phone +358 500 980 565

Reply all
Reply to author
Forward
0 new messages