Add menuitems after "new menuname" before drawmenu

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
raymond
Beginner
Beginner
Posts: 3
Joined: Thu Dec 21, 2006 9:44 am

Add menuitems after "new menuname" before drawmenu

Post by raymond »

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: Select all

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();
Regards,

Raymond
Last edited by raymond on Thu Dec 21, 2006 9:45 pm, edited 1 time in total.
rjmjr9
Advanced
Advanced
Posts: 20
Joined: Sat Oct 28, 2006 9:32 pm

Post by rjmjr9 »

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.
raymond
Beginner
Beginner
Posts: 3
Joined: Thu Dec 21, 2006 9:44 am

Post by raymond »

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.
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

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: Select all

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();
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://milonic.com/menumodules.php

Ruth
raymond
Beginner
Beginner
Posts: 3
Joined: Thu Dec 21, 2006 9:44 am

Post by raymond »

Thanks! I'll look into the module as soon as the page doesn't give me a:

Code: Select all

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
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

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://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 viewtopic. ... 0424#40424
Hope this helps.

Ruth
Post Reply