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')), ), ), ), ), ), ));
Replace
<div id="mainmenu">
with
<div id="mainMbMenu">
to avoid conflicts with the standard CSS for the menu.
Total 20 comments
Hi I'm trying to have a different image depending on the page I'm on (like an active or current link). Here is my code.
'active'=> This doesn't have any effect.
Also is there a hover feature for images too
Thanks
try after removing assets files under projectFolder/assets/*
@kiran sharma at protected\extensions\mbmenu\source folder..i change the nav1_active1.gif file, it suppose to be change the color of the menu, but it don't, and you know what? even all file at protected\extensions\mbmenu\source folder i deleted and let the ..\source folder empty it's still give me the same menu layout...:( have you try to vanished file in the ..\source folder??
i had use this extension much time before. and as i know menu background is generated by image(s), so to change background color you had to replace that image(s). you can found that images and their path by inspect element.
seriously i can't change or modify the menu style, event all asset in protected\extensions\mbmenu\source i deleted it still not effect.
I'm having trouble to change the style. How can I do it?
How can I make the drop down list automatically gather all my models, is it possible with this extension? So for example if I click on one of my Menu items "Products" I want all the products model to show on the drop dow.
Thanks
Very nice extension! Awesome!
Great extension, thank you!
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">
Leave a comment
Please login to leave your comment.