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:42
Relative Links (again)
Poster: stephen702
Dated: Wednesday February 18 2004 - 17:25:32 GMT
I spoke too soon. I'm still having problems trying to use paths in the menu_data.js file and also in html pages.
This is new territory for me, and I clearly am not grasping some very basic concepts. Perhaps someone can look at the problems below, and figure out why this is turning into a monumental frustration for me.
I'm on a shared server, and the path (at least in FTP) is: /home/aact/www/
PROBLEM ONE: JAVASCRIPT ERROR
When I use the following script in the html header of a page [in the directory /home/aact/www/start], it produces a javascript error message that "ns4 is undefined"
<SCRIPT language=JavaScript src="/home/aact/www/milonic_src.js" type=text/javascript></SCRIPT><script language=JavaScript>if(ns4)_d.write("<scr"+"ipt language=JavaScript src=/home/aact/www/mmenuns4.js><\/scr"+"ipt>");else _d.write("<scr"+"ipt language=JavaScript src=/home/aact/www/mmenudom.js><\/scr"+"ipt>");</script><SCRIPT language=JavaScript src="/home/aact/www/menu_data.js" type=text/javascript></SCRIPT>
You can see the error at: http://www.aact.org/start/index2.html
PROBLEM TWO: THE FAULTY MENU
If I change the script on the page referenced above to the following, I get a menu, but the images and links don't work:
<SCRIPT language=JavaScript src="../milonic_src.js" type=text/javascript></SCRIPT><script language=JavaScript>if(ns4)_d.write("<scr"+"ipt language=JavaScript src=../mmenuns4.js><\/scr"+"ipt>");else _d.write("<scr"+"ipt language=JavaScript src=../mmenudom.js><\/scr"+"ipt>");</script><SCRIPT language=JavaScript src="../menu_data.js" type=text/javascript></SCRIPT>
You can see the faulty menu at: http://www.aact.org/start/index3.html
I'm sure that the faulty menu results from a problem in the menu_data1.js file, but I don't know what's causing links and images to fail.
The menu_data1.js syntax is:
aI("text=Logos;url=/home/aact/www/members/logos.html;image=/home/aact/www/dot_gold.gif;status=Logos");
However, the "dot_gold image" doesn't display and the "url=" sends the browser to a non-existent URL [http://www.aact.org/home/aact/www/logos.html]
THANKS FOR ANY HELP OR SUGGESTIONS.
Poster: Maz
Dated: Wednesday February 18 2004 - 17:46:05 GMT
The paths are not quite right,
I locate your js files here
http://www.aact.org/menu_data.js
Therefore all you need is /menu_data.js
Do the same for the images /image.gif
You can ignore everything before www and from www add the slash.
Correct all your paths and you should have it working.
Regards,
maz
Poster: stephen702
Dated: Wednesday February 18 2004 - 19:38:23 GMT
Maz's explanation of how to code the relative path seems to be working:
http://www.aact.org/start/index2.html
However, while the menu now displays (and works) online, it doesn't display at all when I view the page on my computer, where I always test before uploading. I assume that Windows doesn't understand the path in the header:
<SCRIPT language=JavaScript src="/milonic_src.js" type=text/javascript></SCRIPT><script language=JavaScript>if(ns4)_d.write("<scr"+"ipt language=JavaScript src=/mmenuns4.js><\/scr"+"ipt>");else _d.write("<scr"+"ipt language=JavaScript src=/mmenudom.js><\/scr"+"ipt>");</script><SCRIPT language=JavaScript src="/menu_data1.js" type=text/javascript></SCRIPT>
Since I am in the process of redesigning all pages with the Milonic menu, I need to see the menu displayed. For any pages in the main directory, I can just take out the "/", but that still leaves those pages in subdirectories.
Is there a solution to this?
Many thanks!
Poster: stephen702
Dated: Wednesday February 18 2004 - 20:14:32 GMT
On my own computer, not only does the menu not display, but I get a "runtime error" message that "ns4 is undefined"
Poster: heinrichegg
Dated: Thursday February 19 2004 - 0:29:42 GMT
I have almost the same problem as you. I wrote about it long time ago, but I never got a solution that worked.
For now I have all the .htm files in one directory <root>/norwegian. The .js scripts are in another <root>scripts/ver_5_0/
My code in each .htm file is like this:
<SCRIPT language=JavaScript src="../scripts/ver_5_0/milonic_src.js" type=text/javascript></SCRIPT>
<script language=JavaScript>
if(ns4)_d.write("<scr"+"ipt language=JavaScript src=../scripts/ver_5_0/mmenuns4.js><\/scr"+"ipt>");
else _d.write("<scr"+"ipt language=JavaScript src=../scripts/ver_5_0/mmenudom.js><\/scr"+"ipt>");
</script>
This works. Hovewer, I would like to move .htm files into subdirectories. I also use one temlate for all my pages and I would like to store the pages in different subdirectories and different levels.
I use Dreamweaver and all relative paths are automatically adjusted when I save a new file based on the template or if I move a file up or down into the directorystructure.
Hovewer, this part of the code is not updated since Dreamweaver does not recognise this as links:
if(ns4)_d.write("<scr"+"ipt language=JavaScript src=../scripts/ver_5_0/mmenuns4.js><\/scr"+"ipt>");
else _d.write("<scr"+"ipt language=JavaScript src=../scripts/ver_5_0/mmenudom.js><\/scr"+"ipt>");
Many on this forum writes that I can use this syntax:
if(ns4)_d.write("<scr"+"ipt language=JavaScript src=/scripts/ver_5_0/mmenuns4.js><\/scr"+"ipt>");
else _d.write("<scr"+"ipt language=JavaScript src=/scripts/ver_5_0/mmenudom.js><\/scr"+"ipt>");
Then the code will always start from the root.
I have never got this syntax to work? Not on my own computer - my local copy, or on the webserver (shared webhotel).
Does this has something to do which webserver the site is running on? Locally I am running the IIS that is included in Win XP Pro. What is on the webhotel I do not know.
Thanks!
H
Poster: Maz
Dated: Thursday February 19 2004 - 9:58:03 GMT
I make changs on the server, if you already have a site running you could make a test page and change the name menu-data.js on the template. That way you don't have any surprises when you finally upload it.
Sorry I can't help with the other questions.
maz