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:21
How to have different menus in different pages on one site?
Poster: pyrliu
Dated: Monday August 11 2003 - 11:40:06 BST
How would you advice me to solve the following problem:
I have a site which includes multiple pages and sub-pages. I have about 5 different pages (on the same site) that needs different dhtl-menus to run at pages. Five different pages and five different menus (with their own submenus and their own information).
If I try to make the
function setValue()
{
mn=getMenuByName("Menu1")
menu=eval("menu"+mn)
menu[10]=parseInt(document.f1.t1.value)
}
to call different menus on different pages, the result is that only one menu is visible on all the pages, even if the mn=getMenuByName("Menu1") is changed.
And the menu that is visible is the one that has the
1, // Always Visible
variable as 1.
I have tried to make different named menu_array.js files including different menus.. that didn't work. (I also changed the script )
<SCRIPT language=JavaScript src="menu_array.js" type=text/javascript></SCRIPT>
to
<SCRIPT language=JavaScript src="menu1_array.js" type=text/javascript></SCRIPT>
and on the second page it was..
<SCRIPT language=JavaScript src="menu2_array.js" type=text/javascript></SCRIPT>
and so fort...
It didn't work.
I also tried to make many menus inside the menu_array.js file with all the visibility as 0. That didn't show anything.
So only solution would be that I make all the different pages that I want to include different menus.. in different subfolder in the server. But thats a really crappy solution concerning all the other code that has to suffer just because of the menu.
I hope that somebody with more knowledge about the menu could help me in this matter.
Actually I found a way...
Poster: pyrliu
Dated: Monday August 11 2003 - 13:34:17 BST
Yeps... it can be done by inserting the code in the page. So you can have a different menu in different pages..
Just had to go and have a look that how Milonic had done their example pages... where there are many different menus visible in one page.
Should have found that out before I posted my topic...
Sorry
Poster: Hergio
Dated: Monday August 11 2003 - 13:51:34 BST
First things first, do you have a URL we could see your pages and code at? This would GREATLY improve the way and speed at which we can help.
Secondly,
Quote:
I have tried to make different named menu_array.js files including different menus.. that didn't work. (I also changed the script )
<SCRIPT language=JavaScript src="menu_array.js" type=text/javascript></SCRIPT> to
<SCRIPT language=JavaScript src="menu1_array.js" type=text/javascript></SCRIPT>
and on the second page it was..
<SCRIPT language=JavaScript src="menu2_array.js" type=text/javascript></SCRIPT>
and so fort...
<SCRIPT language=JavaScript src="menu_array.js" type=text/javascript></SCRIPT> to
<SCRIPT language=JavaScript src="menu1_array.js" type=text/javascript></SCRIPT>
and on the second page it was..
<SCRIPT language=JavaScript src="menu2_array.js" type=text/javascript></SCRIPT>
and so fort...
What it sounds like is you have all these pages. All the pages have a menu called menu_array, but then you want each page to have an individual menu in addition to the first one, and those will have different names. Correct me if I am wrong. What you mentioned sounds like it should work. Each page looking like the following sounds right...
Code:
<SCRIPT language=JavaScript src="milonic_src.js" type=text/javascript></SCRIPT>
<SCRIPT language=JavaScript src="xpmenu_data.js" type=text/javascript></SCRIPT>
<SCRIPT language=JavaScript src="otherMenu1.js" type=text/javascript></SCRIPT>
//....and another page like .....
<SCRIPT language=JavaScript src="milonic_src.js" type=text/javascript></SCRIPT>
<SCRIPT language=JavaScript src="xpmenu_data.js" type=text/javascript></SCRIPT>
<SCRIPT language=JavaScript src="otherMenu2.js" type=text/javascript></SCRIPT>
<SCRIPT language=JavaScript src="xpmenu_data.js" type=text/javascript></SCRIPT>
<SCRIPT language=JavaScript src="otherMenu1.js" type=text/javascript></SCRIPT>
//....and another page like .....
<SCRIPT language=JavaScript src="milonic_src.js" type=text/javascript></SCRIPT>
<SCRIPT language=JavaScript src="xpmenu_data.js" type=text/javascript></SCRIPT>
<SCRIPT language=JavaScript src="otherMenu2.js" type=text/javascript></SCRIPT>
Just make sure no menu names repeat themselves between the two menus and all your script paths are right. The v5 menu allows you to define multiple menus from different menu.js files with out problems. A sample URL to your site would be best.
Thank you for the solution!
Poster: pyrliu
Dated: Monday August 11 2003 - 15:29:49 BST
Thanks!
That solved the problem in no time.
I had couple of typos and the menunum=0;menus=new Array()... line intact in the other array files. That was my mistake.
Thank thee and do accept my humblest gratitude.. I shall take heed of thy learnings and make myself a better wannabewebpagedesignerwithabigsalary!
Thank you