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:30
Hi All, menus in Nested Loops
Poster: rajereddy
Dated: Tuesday August 28 2007 - 16:07:52 BST
Hi All,
i just started using this menu and trying to convince my client to get this, but to convince them, I am just trying to create a prototype oif thier requirement.
The requirement is to create a menu using nested loops... may be there is an alternative approach, if so suggest me.
i am writing a code where i create a bunch of Main menus and each menu having bunch of sub menu items.. the code that I am using is
---------------------
Code:
with(mainmenu=new menuname("Main Menu")){
alwaysvisible=1;
left=10;
orientation="horizontal";
style=menuStyle;
top=10;
for (i=0; i<20; i=i+2){
Name = "Menu" + i;
j = i+1;
var ShowName = "Menu" + j;
aI("text="+Name+";url=http://www.milonic.com/;showmenu="+ShowName);
with(submenu=new menuname(ShowName)){
left=10;
orientation="horizontal";
style=menuStyle;
for (k=0; k<20; k = k+2){
SubName = "SubMenu" + k;
aI("text="+SubName+";url=http://www.milonic.com/;");
};
}
};
}
alwaysvisible=1;
left=10;
orientation="horizontal";
style=menuStyle;
top=10;
for (i=0; i<20; i=i+2){
Name = "Menu" + i;
j = i+1;
var ShowName = "Menu" + j;
aI("text="+Name+";url=http://www.milonic.com/;showmenu="+ShowName);
with(submenu=new menuname(ShowName)){
left=10;
orientation="horizontal";
style=menuStyle;
for (k=0; k<20; k = k+2){
SubName = "SubMenu" + k;
aI("text="+SubName+";url=http://www.milonic.com/;");
};
}
};
}
---------------------
the output that i get with that code is
Menu0
submenu0 submenu2 ... submenu20 menu2 [see here that menu2 is added as submenu to Menu0, not as a separate menu item, which i am expecting]
but i want
[main menu]Menu 0, Menu 2, Menu 4 with each one having [submenu] "submenu 0 ... submenu20" menuitems as submenu.
so, could you please help me in building this type of menu dynamically in nested loops. I looked at the dynamic menus api, but am not sure whether that will help me out.
I would appreciate a snippet of code to achieve this.
Thanks
Reddy
could you please help me ?
Poster: rajereddy
Dated: Tuesday August 28 2007 - 22:56:09 BST
Hi Andy/ Ruth,
Could you please let me know what API should I use? should I be using mm_inseritem() etc... i tried to use those with no sucess.
Hmm :-(
Poster: rajereddy
Dated: Wednesday August 29 2007 - 20:18:06 BST
Could some one please help regarding this?
Poster: Ruth
Dated: Thursday August 30 2007 - 5:45:14 BST
Hi,
I have posted this to Milonic. I can't help because what you're doing is way beyond me.
There is a module called menueditapi.js on this page.
http://www.milonic.com/menumodules.php
I suggest you also contact Milonic from the main site http://www.milonic.com
I'm sorry I can't help....
Ruth
Thanks for your reply
Poster: rajereddy
Dated: Friday August 31 2007 - 14:49:09 BST
Ruth,
THanks for your reply. I will contact Milonic as said.
Thanks