Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:46
Add menuitems after "new menuname" before drawmenu
Poster: raymond
Dated: Thursday December 21 2006 - 8:58:58 GMT
Hello!
My javascript is not too brilliant, so the following question:
Is it possible to add menuitems to the same submenu after the "new menuname" but before drawmenus()?
Example (which doesn't work ofcourse ):
Code:
with(milonic=new menuname("Submenu")){
style=subStyle;
Itemwidth=195;
aI("text=Item A;url=blaA;status=Item A;");
aI("text=Item B;url=blaB;status=Item B;");
}
with(milonic=menuname("Submenu")){
aI("text=Item C;url=blaC;status=Item C;");
}
drawMenus();
style=subStyle;
Itemwidth=195;
aI("text=Item A;url=blaA;status=Item A;");
aI("text=Item B;url=blaB;status=Item B;");
}
with(milonic=menuname("Submenu")){
aI("text=Item C;url=blaC;status=Item C;");
}
drawMenus();
Regards,
Raymond
Poster: rjmjr9
Dated: Thursday December 21 2006 - 17:12:22 GMT
The Sub menu names have to be different. Each of those are menus themselves. If they share the same name, then you have a conflict and the menus won't show.
Poster: raymond
Dated: Thursday December 21 2006 - 20:40:49 GMT
Well that's exactly the problem. I do not want to add another submenu, but I want to add an extra item to the same submenu!
Therfore the second piece of code doesn´t have a "new" statement.
Poster: Ruth
Dated: Thursday December 21 2006 - 22:35:09 GMT
Hi,
If you mean you just want to edit that submenu so it has one more item, then you'd just open the file and add the item
Code:
with(milonic=new menuname("Submenu")){
style=subStyle;
Itemwidth=195;
aI("text=Item A;url=blaA;status=Item A;");
aI("text=Item B;url=blaB;status=Item B;");
aI("text=Item C;url=blaC;status=Item C;");
}
drawMenus();
style=subStyle;
Itemwidth=195;
aI("text=Item A;url=blaA;status=Item A;");
aI("text=Item B;url=blaB;status=Item B;");
aI("text=Item C;url=blaC;status=Item C;");
}
drawMenus();
If you mean you want it to not be there but then be added, then you probably want the menueditapi.js module which you can download from the bolt-on modules page
http://www.milonic.com/menumodules.php
Ruth
Poster: raymond
Dated: Friday December 22 2006 - 6:51:40 GMT
Thanks! I'll look into the module as soon as the page doesn't give me a:
Code:
Fatal error: Cannot redeclare getmoduledata() (previously declared in /usr/home/milonic/menumodules.php:11) in /usr/home/milonic/includes/functions.php on line 730
Regards,
Raymond
Poster: Ruth
Dated: Friday December 22 2006 - 8:29:13 GMT
Hi,
I'm getting it, also. Must be some glitch.
However, if you have downloaded the menu, then when you unzip the files you should get an extras folder and in that folder is one called dynamic_menus and in that folder is the menueditapi.js module.
That folder also has a page which has a 'tool' that let's you create a new menu and then add items to it and it outputs the code you would need. It doesn't have all the things you can do with the module but that should get you started.
Also, there is a page here http://www.milonic.com/menueditapi.php with more things. But it doesn't have the changeItem which is also part of the module. Here is a post that has info in it http://www.milonic.com/forum/viewtopic. ... 0424#40424
Hope this helps.
Ruth