MbMenu is an extension to CMenu wich provides you a nice dropdown menu.
protected/extensionsThe usage of this extension is allmost the same like CMenu.
The following example shows how to use MbMenu:
$this->widget('application.extensions.mbmenu.MbMenu',array( 'items'=>array( array('label'=>'Home', 'url'=>array('/site/index')), array('label'=>'Contact', 'url'=>array('/site/contact'), 'items'=>array( array('label'=>'sub 1 contact'), array('label'=>'sub 2 contact'), ), ), array('label'=>'Test', 'items'=>array( array('label'=>'Sub 1', 'url'=>array('/site/page','view'=>'sub1')), array('label'=>'Sub 2', 'items'=>array( array('label'=>'Sub sub 1', 'url'=>array('/site/page','view'=>'subsub1')), array('label'=>'Sub sub 2', 'url'=>array('/site/page','view'=>'subsub2')), ), ), ), ), ), ));
Total 20 comments
As CMenu's hideEmptyItems property is a bug according to issue 3029. And it's already fix in Yii's 1.1.9 as MbMenu bases on CMenu and has override a function normalizeItems so it should be fixed too.
It's useful for me. Great job!
How can we use Ajax links.
Why isnt this part of the installation instructions. change div id = "mainmenu"> to.. div id = "mainMbMenu">
in protected/views/layouts/main.php
I have now cleared the Assets folder in the root directory (was not previously familiar with it), and I still can not edit the styles. Changes made to the mbmenu.css file in the /protected/extensions/mbmenu/source folder do not edit the menu. I assume the menu would use the mbmenu.css for formating, but I can delete the file with no effect to the menu styling. The current styling of the menu is the same as the example at http://yii.heyhoo.com/mbmenu/. What else could I check? Thanks for your help.
@starsight: did you clear the assets folder?
Have tried to edit the mbmenu.css file in the extensions/mbmenu/source folder but there were no changes. What could be wrong?
Hi, I modified your function. The only thing I did was add the directory containing the icons in the extension. In my opinion this better ordered.
and within the source directory, I created a directory called icons.
Finally in the menu instead of calling "image" with the path, I indicate only the name of the image.
certainly, this isn't the best choice but works for me.
I had extend your mbmenu extensions with icon and text
Mbmenu.php
and how to use
To theme this fine menu extension all you need to do is define 'cssFile'=>'/some/url/to/file.css' and copy the images to the same directory.
This is good cause this way you can customize the images too without changing the original extension code
However with the existing code there is a small problem:
To solve this you have to change the extension file protected/extensions/mbmenu/MbMenu.php from:
To:
Everything works ok.
The assets folder is created
The file mbmenu.css and the images are loaded from the alternate directory /some/url/to/
The file mbmenu_iestyles.css is loaded from the original assets directory
This is only a problem if you use IE < 8 whichif you want a really cross browser webapplication is important
Hope this helps.
Good coding!!!
This extension works well with me.. The most important things, make sure that you modify the
<
div id = "mainmenu"> to..
<
div id = "mainMbMenu">
nevermind, I've added another dropdown and it's working now...??
Very nice extension, it was what I was looking for but... how come in IE9 parent li doesent have any ul inside, so no dropdown?
I'm loving the menu, but not sure how to go about making it themeable? Is it possible?
Also, is there any way of not having to change the menu structure in each theme layout and just do it in one place?
Thanks.
I tried many different menus but this one has finally rescued me. Thanks A lot.
It is worth to note that MBMenu has some problems (menu drawing and handling bugs) when one is using menu with more than two sub levels. See this forum post for more information.
since yii using blueprint css.. and maybe not much people use custom css.. please add:
it will ensure this menu goes into new line. and i can't set it via htmlOptions. (htmlOptions will only set menu items)As long as you rename the menu id in main.php layout
id="mainmenu" becomes something like id="mainMbMenu"
to avoid the css conflict as mentioned by igorsantos07.
Exactly what I wanted and it seems to be very compatible with the standard CMenu
Great menu! But a note for ppl that want it to "just work": the original Yii CSS conflicts with this menu. You should remove entries for #mainmenu from css/main.css or rename the ID in your layout for something, like, 'id="menu"' instead of 'id="mainmenu"'.
@Raoul: it now also works under IE6. Please download the latest release.
Leave a comment
Please login to leave your comment.