- Menu is displayed vertically
- Toplevel items is a link
- Accordion has indicators to show the state of the menu
Extension have a small size (near 18kb) but depends on jQuery.
Requirements ¶
Yii 1.1.x or above
Usage ¶
Crete menu items array
$items = array(
array(
'name' => 'Google corp',
'link' => 'http://google.com',
'icon' => 'google',
'active' => 'dashboard',
'sub' => array(
array(
'name' => 'Gmail',
'link' => 'http://gmail.com',
),
array(
'name' => 'Gmap',
'link' => 'http://maps.google.com/',
)
)
)
);
Use menu widget:
$this->widget('ext.menu.EMenu', array('items' => $items));
Nice Menu !
Seems well behaved.
Have you done any integration with mysql db? I think it would be easy to format the structure, just curious if you had done so and had any advice or suggestions on what to do/avoid.
Thanks!
RE: AustinGeek
You gave me idea, I'll think about it on weekend
Add Icon to Second Level
I don't know if there is a better way to do this but this is what i did to have 2nd level icons.
in emenu.php:
After
if( $level == 1 ){ ...content }
Add
if( $level == 2 ){ $icon_class = isset($item['icon']) ? $item['icon'] : 'none'; $icon_class = 'menu_icon ' . 'icon-' . $icon_class; $icon = CHtml::tag('span', array('class'=> $icon_class), ''); $toggleOptions = array( 'class' => $toggleclass ); $toggleContent = $icon . $content; $content = $toggleContent; }
You can call it just like you do on level one with 'icon'=>'icon',.
array( 'name' => 'Assets', 'link' => array('/assets/index'), 'icon' => 'barcode', 'active' => 'assets', 'sub' => array( array( 'name' => 'List Assets', 'link' => array('/assets/index'), 'icon' => 'th-list', ), ) ),
Active
Edit: just isn't working with yii-user
Active doesn't work if it's a module's controller.
i.e. I'm using user module so the url is mydomain/user. I put user in the active class like this:
array( 'name' => 'Users', 'link' => array('/user'), 'icon' => 'user', 'active' => 'user', 'sub' => array( .......
and it doesn't register it as being active when on mydomain/user.
Hovering ?
Hello,
How would you modify the menu to open up when hovered instead of clicked ?
Thanks,
Jonathan
Re: isn't working with yii-user
To skworden at 2013/01/11 12:45pm (#11409)
As I know yii-user is extension. I Also use own user extension in my app, so I write :
where
RE: Nikolay I. Belichuk
Is there a way you could make it so active = any of the URLs that are in the top and sub menus? That way your sub menu items could be anything and not stuck to the one controller if you want it to be active.
I kinda get what your saying but I'm still not understanding completly.
I couldn't get your method to work at all. This module uses so many different controllers and I don't know a way to get it to work for say /user/profilefield or /user/profilefield/create.
What would I put in the active class for this to register? If I put user in the active class it will expand if you go to mydomain.com/user/user however, not on anything other than that.
here is what I'm using.
array( 'name' => 'Users', 'link' => array('/user/user'), //it won't be active with just /user/ or user/index 'icon' => 'user', 'active' => 'user', 'sub' => array( array( 'name' => 'List Users', 'link' => array('/user/user'),//Only link that will register as active 'icon' => 'th-list', ), array( 'name' => 'Add User', 'link' => array('/user/admin/create'),//dosen't register as active 'icon' => 'plus-sign', ), array( 'name' => 'Edit Users', 'link' => array('/user/admin'),//dosen't register as active 'icon' => 'pencil', ), array( 'name' => 'List User Fields', 'link' => array('/user/profilefield'),//dosen't register as active 'icon' => 'list-alt', ), array( 'name' => 'Edit User Profile Fields', 'link' => array('/user/profileField/admin'),//dosen't register as active 'icon' => 'plus-sign', ), array( 'name' => 'Add User Profile Field', 'link' => array('/user/profileField/create'),//dosen't register as active 'icon' => 'edit', ), ) ),
i am having error
Fatal error: Class 'EMenu' not found in C:\xampp\htdocs\yii\framework\web\CWidgetFactory.php on line 147
resolving Error loading EMenu.php
for thoes who had a problem when adding this extension, you may edit the "EMenu.php" by adding
<?php
on the top.
Version 1.1
Extension support module check, so you can use
> 'active' => 'user/module/index'
And everything will be fine
Keep open selected item
Hi.
Nice extension I have to say. Congrats.
What I want to know is how to keep the parent item of a clicked subitem expanded.
Any idea?
to jmariani
Can you provide more information about this behavior?
Custom Icon from link
Is there any parameter to change custom icon from a link?
Thanks,
nice menu
hhmmm how to make the menu like skworden made using this extension
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.