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:11
2 menus on one page - Main & Sub
Poster: shane.allied
Dated: Thursday March 9 2006 - 12:35:39 GMT
Hi,
I currently have the menu system running perfectly well as a standard horizontal menu bar at the top of my site. It has 5 horizontal options, each of which has a vertical submenu when you hover over.
What I want to be able to do, is once one of the main menu buttons has been clicked and you go to a page for that "section", I want to show the submenu for that part to be constantly vision as a left hand vertical menu, whilst keeping the main horizontal menu as before.
I have managed to "cheat" and get this working by duplicating the sub menu, however that would mean that any changes i make to the submenu in the future, I would have to make twice which is extremely bad practise and i am sure is not the way to do it.
The code I have at present (if it helps) in my page files for the menus is as follows:
MAIN MENU
<script type="text/javascript">
with(milonic=new menuname("Main Menu")){
alwaysvisible=1;
margin=0;
orientation="horizontal";
position="relative";
style=mainStyle;
aI("align=center;showmenu=Home;text=HOME;url=/index.asp;");
aI("align=center;showmenu=About;text=ABOUT;url=/about.asp;");
aI("align=center;showmenu=Games;text=GAMES;url=/games.asp;");
aI("align=center;showmenu=Music;text=MUSIC;url=/music.asp;");
aI("align=center;showmenu=Sport;text=SPORT;url=/url=/sport.asp;");
}
drawMenus();
SUBMENU
<script type="text/javascript">
with(milonic=new menuname("Music Menu")){
style=menuStyle2;
alwaysvisible=1;
orientation="vertical";
position="relative";
margin=2;
aI("text=Artic Monkeys;url=/music_artic.asp;");
aI("text=James Blunt;url=/music_blunt.asp;");
aI("text=Linkin Park;url=/music_linkin.asp;");
aI("text=Ordinary Boys;url=/music_boys.asp;");
aI("text=Will Young;url=/music_young.asp;");
}
drawMenus();
</script>
The menu_data.js includes the styles and all of my sub menus (the above included).
Any help would be appreciated, thanks.
Poster: Migru
Dated: Thursday March 9 2006 - 13:17:35 GMT
Hi
as you´re not creating the menu from a database it seems, there is no way out from having the subs, part of the horizontal menu and each page with an additional vertical second main menu (left handed, as you say).
In my opinion, an alternative would be a vertical so called treemenu or collapsible menu, left handed, combined with the openmenusbyurl module , treemenu and openmenubyurls you find on the " Bolt-on modules " page (main menu) to download.
samples of such menus are here:
http://www.milonic.com/treemenu/
Michael
thanks, but no..
Poster: shane.allied
Dated: Thursday March 9 2006 - 14:22:41 GMT
Thanks for your reply. I've had a look at those tree examples but for presentation if nothing else I dont like that, and they dont really solve my issue.
Is there a way to draw a menu on your page that is already defined in the menu_data.js file, without defining everything from scratch, as if you were creating a new menu?
If that is possible, then I would only need to define the submenu once and then can refer to it as a submenu one way, and as a main menu in another.
Thanks.
Poster: vikenk
Dated: Thursday March 9 2006 - 14:35:41 GMT
Hi,
I've never done what I'm about to propose, but it could work in theory :>)
You could use the menu propery "alwaysvisible", which would keep a submenu open, then use the "Drag & Drop" js script to allow the user to drag the submenu around the page to use.
I haven't tested it though. It sounds like it should work. The "alwaysvisible" command is described in the Menu Properties section of the Milonic site. I have copied and pasted it below.
alwaysvisible - alwaysvisible is used to promote standard sub menus to main menu. The alwaysavailable property will constantly keep a menu open and in position.
Hope this works.
Poster: Migru
Dated: Thursday March 9 2006 - 18:04:45 GMT
Hi
you can go through all these DHTML menu samples, please see the milonic start page main menu (DHTML menu) and there topic no 4., select one you like and download the sample menu code as menu_data.js file to your site.
In that sample, using a text editor, you have to edit the text /url / and showmenu property, for each topic (aI-string) , in order to adapt it to your needs.
Your left handed "subs", which you want, in fact aren´t anything else than a second main menu each on corresponding pages. (copy of a sub, but modified to a main) They do not need different styles, just an alwaysvisible=1; , an orientation="vertical"; and the position set, depending on absolute positioning with top= ; or left= ; or relative positioning, I don´t know, depending on your layout. They may have even the same styles setting. Relative positioning means, just to place that menu without the styles "commands" (they are already defined with the horizontal menu) into a tables column for instance between <script> </script> tags but with drawmenus(); The first aI("text=..";type=header;"); of these menus could be header type.
And absolute positioning of course means, that this menu has its own position set, (top/left) exactly as the horizontal menu has it.
Thats it, some cut/copy/paste and editing the text, to make editing as simple as possible.
Michael
missing the point
Poster: shane.allied
Dated: Friday March 10 2006 - 14:24:09 GMT
I think your missing my point.
I dont want to have a particular menu's code in 2 seperate files (my html file and the menu_data.js file), as when i want to add or remove a menu option, i will have to open and edit both files exactly.
I want to be able to refer to the menu as a submenu and main menu, on the same page at the same time.
Poster: Migru
Dated: Friday March 10 2006 - 15:22:56 GMT
Hi
....which means, I have already given my reply and thoughts on this (first sentence, my first post...see above)
Michael
no no
Poster: shane.allied
Dated: Friday March 10 2006 - 15:25:22 GMT
Thanks Michael, but that treemenu is extremely poor. I would definately not want to sacrifice quality of menu over functionality.
Poster: Migru
Dated: Friday March 10 2006 - 15:29:47 GMT
Oh no
Quote:
as you´re not creating the menu from a database it seems, there is no way out from having the subs, part of the horizontal menu and each page with an additional vertical second main menu (left handed, as you say).
Thats my first sentence, isn´t it?
Michael