One menu for all????

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
User avatar
Matt Stano
Beginner
Beginner
Posts: 9
Joined: Wed Aug 31, 2005 9:15 pm
Location: Hampton, NH

One menu for all????

Post by Matt Stano »

Ok, I'm relatively new to the 5 version, was using 3.0 So how do I make all the webpages call just one single menu array? Is there a global command of some sort? So I've basically taken the sample and changed the words and pointers so far. Added the little bit code to my main index page and that's where I am. Any help would be much appreciated.

Thanks,

Matt
-------------------------------
"Outside a dog, a book is man's best friend.
Inside a dog, it's too dark to read."
~Groucho Marx~

Matthew Stano
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Hi Matt,

I'm not sure I understand what you mean.

If you have created a menu_data.js file with all your information in it, then you would just place the call for all the menu files on each page just like you had to do with the version 3.

Or are you by chance using frames?

Ruth
User avatar
Matt Stano
Beginner
Beginner
Posts: 9
Joined: Wed Aug 31, 2005 9:15 pm
Location: Hampton, NH

One menu for all????

Post by Matt Stano »

Hi Ruth, thanks for the reply. I'm coming from the old 3.3 version of DHTML so I'm having a little trouble in translation. Here's what happens:
I have (in my mind) a fairly simple folder layout where individual pages are located; ie:
-root
--tech
---newsletters
---videos
--calendars
---building
---foodservice

well you get the idea...
So my issue is that on the top level the navigation from DHTML works great, but when I go to a page, in say the, root\tech\newletters folder and then jump to root\calendars\building I have an issue with my path. The navigation once I'm deep in the folder structure needs to be adjusted to ..\..\calendars\building. So I wind up having multiple menu scripts. What is the simpliest way to make this work for me so I don't need to have more than one menu script? Is it possible? Thanks for your help.

Matt
-------------------------------
"Outside a dog, a book is man's best friend.
Inside a dog, it's too dark to read."
~Groucho Marx~

Matthew Stano
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

I call my menu code files with an include like this...

Code: Select all

<script language="javascript" src="/sa/menu5/milonic_src.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
<!--
if(ns4)_d.write("<scr"+"ipt language=javascript src=/sa/menu5/mmenuns4.js><\/scr"+"ipt>");
else _d.write("<scr"+"ipt language=javascript src=/sa/menu5/mmenudom.js><\/scr"+"ipt>");
-->
</script>
The leading / in the path means the call is server-relative, so regardless of the level from which the call is made the files will always be found. My _data files, being different for each of the 25 or so sites I handle, are included on the individual pages in a td.

BTW, your '..\..\calendars\building' should be ../../calendars/building, etc., but don't get into that kind of addressing. It's much too restrictive.
John
User avatar
Matt Stano
Beginner
Beginner
Posts: 9
Joined: Wed Aug 31, 2005 9:15 pm
Location: Hampton, NH

One menu for all????

Post by Matt Stano »

Hi John, thanks. So let me get this part straight. You have individual menu_data.js files for each page?

here is the code from my main page:



<script type="text/javascript" src="java2/milonic_src.js"></script>
<script type="text/javascript">

if(ns4)_d.write("<scr"+"ipt type=text/javascript src=java2/mmenuns4.js><\/scr"+"ipt>");
else _d.write("<scr"+"ipt type=text/javascript src=java2/mmenudom.js><\/scr"+"ipt>");
</script>

<script type="text/javascript" src="java2/menu_data.js"></script>


It looks like yours, maybe I'm missing something. You said that the menu_data are on the individual pages in a table. Are these menu structures altered to account for being deeper in the folder structure?

and lastly you said:
"../../calendars/building, etc., but don't get into that kind of addressing. It's much too restrictive."

Ok, I give, what other way would you address it? I'm kind of a newbie to the java side of things. Is there really an easier way?
Thanks for your guidance.

Matt
-------------------------------
"Outside a dog, a book is man's best friend.
Inside a dog, it's too dark to read."
~Groucho Marx~

Matthew Stano
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Hi,

I think what John meant [boy I hate paths] is that the

Code: Select all

"/sa/menu5/milonic_src.js"
having the / in front of the sa folder name says that the file is in

Code: Select all

"rootdirectory/sa/menu5/milonic_src.js"
:oops: I gave up and I just use darned full paths....

Ruth
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

Ruth is correct. The leading / starts the search from the root level of my server, regardless of what 'level' I might be on in the menu structure (or any other, for that matter). In this case, my full path is http://www.west.asu.edu/sa/menu5/milonic_src.js, but why type all that every time?

This is especially handy for those times you might move a file to another directory or 'level'. Doesn't matter where you put the file, /sa/menu5/milonic_src.js will always start at the root and find this file, regardless. No more ../../ junk.
John
User avatar
Matt Stano
Beginner
Beginner
Posts: 9
Joined: Wed Aug 31, 2005 9:15 pm
Location: Hampton, NH

One menu for all????

Post by Matt Stano »

Hi John and Ruth,

So I did a lot work and figured out what you guys were telling me. I posted on the server and the pathing began to work as you described. Which is fantastic!! Thanks a bunch. Just one little sticky point. Inside the menu_data.js there is a line for the menu image, a down arrow for me. When I've moved to a page that is deeper in the folder structure I don't see the image anymore. I'm not changing the menu_data.js file. Is there something I need to do there that will fix it?

Thanks again for all your help.

Matt
-------------------------------
"Outside a dog, a book is man's best friend.
Inside a dog, it's too dark to read."
~Groucho Marx~

Matthew Stano
User avatar
Matt Stano
Beginner
Beginner
Posts: 9
Joined: Wed Aug 31, 2005 9:15 pm
Location: Hampton, NH

One menu for all????

Post by Matt Stano »

Ok, I figured it out. I just went back to the menu_data.js file and where it asks me for:

subimage="java2/arrowdn.gif";

I added the forward slash to make it a universal path. So now it reads:

subimage="/java2/arrowdn.gif";


Alright, I feel better for figuring that one out. :-)

Thanks.
-------------------------------
"Outside a dog, a book is man's best friend.
Inside a dog, it's too dark to read."
~Groucho Marx~

Matthew Stano
Post Reply