Milonic provide full featured pull down web menus for some of the worlds largest companies
click here to see what it can do for you

Download Milonic DHTML Menu
Buy Milonic DHTML Menu

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:19

different paths for menue scripts and images


Poster: tigersahrk
Dated: Friday July 16 2004 - 23:42:38 BST

I’m happy with the milonic menue but there is a problem. 8)

All my html-files are in the same directory and the milonic scripts are in the “scripts” folder. Therefore the script path is “/scripts/ milonic_src.js" and the menue including the images works.

But because of write permissions I have to put the some html-files (e.g. guestbook.html) in special folder and then the path to the scripts and images is not correct anymore. Result - if I go to the guestbook it doesn’t work anymore.

I do understand why this problem occurs. Of course I could copy all the images and the scripts in the other folder. But that makes it more complicated if I have to make some changes in the menue … :?:


Poster: Ruth
Dated: Saturday July 17 2004 - 3:28:53 BST

Hi tigersarhk,
Well, I have to say I've always had problems with relative paths. I know most people don't but since I do I now use full url paths to my menu. It doesn't matter then on which page I am, it always looks at the full url to get the menu.

Ruth


Poster: John
Dated: Saturday July 17 2004 - 5:39:20 BST

Server-relative pathing should work fine here, but you haven't given us anything to start with - no URL, no directory layout, etc.


Poster: tigersahrk
Dated: Saturday July 17 2004 - 7:47:25 BST

Okay guys here the URL - First the directory which works
http://www.divesociety.com/phil_dorado/phil_log.asp :)

and the relative path which doesn’t work
http://www.divesociety.com/asp/logbook/logbookList.asp :(

Thanks


Poster: Ruth
Dated: Saturday July 17 2004 - 9:10:34 BST

You need to change the path in the menu_data_phil.js file. It says the images are in images/arrows/ that works fine on the first page since it is in the phil_dorado directory and the menu can find the arrow but when you are at the second page the logbook directory doesn't have images/arrows folders. I get the menu, just not the images. As I said the first time, relative paths have always been my downfall, so keeping that in mind, do you have to put phil_dorado/images/whatever folder/whateverimage.gif as the path or use something like ../ ?

Ruth


Poster: John
Dated: Saturday July 17 2004 - 22:58:36 BST

The two essentially separate sites (phil_dorado) make it a bit tougher to use server-relative addressing. However, if /phil_dorado/ is going to remain forever then you can try this...
Code:
subimage="/phil_dorado/images/arrows/arrow_999999.gif";

etc.


Poster: tigersahrk
Dated: Sunday July 18 2004 - 11:34:42 BST

Yes you're right it works.

As it looks relative paths are my downfall too, so I’m keeping that in mind.
Thanks a lot
werner


Poster: John
Dated: Sunday July 18 2004 - 18:49:25 BST

Keep in mind there is a big difference between 'relative' and 'server-relative' paths. What you just used is server-relative. A relative path is full of ../../ junk, and is not a clean way to program.

More about paths


Poster: TelMgr
Dated: Tuesday July 20 2004 - 2:23:31 BST

John wrote:
Keep in mind there is a big difference between 'relative' and 'server-relative' paths. What you just used is server-relative. A relative path is full of ../../ junk, and is not a clean way to program.


I am one of the many people who have difficulty specifying the correct path for files within sub-directories. I've read the posts and have tried various techniques. Could you look at my site and advise?

This link is to the working menu with all files in the same directory:
http://www.mtholyoke.edu/acad/biol/newsite/. The FACULTY and STAFF menu is the one I've populated. As you'll see, the visitor can click on a faculty member name go to an individual profile and then return to the main faculty page.

This link is to the same site with the faculty pages stored in a sub-directory entitled "faculty". http://www.mtholyoke.edu/acad/biol/tryagain/

I've left the path as "scripts/***.js" in this example. Even when I do get the menus working by specifying "../scripts/***.js" on the faculty pages, the path gets missed up when the visitor tries to return to the main faculty page. The reference is to faculty/faculty.html instead of simply faculty.html.

Thank you.


Poster: John
Dated: Tuesday July 20 2004 - 15:10:55 BST

It's not working from the other directory because your JS calls are wrong, as you surmised.

You now have...
Code:
<script language=JavaScript src="scripts/milonic_src.js" type=text/javascript></script>
<script language=JavaScript>
if(ns4)_d.write("<scr"+"ipt language=Javascript src=scripts/mmenuns4.js><\/scr"+"ipt>");      
  else _d.write("<scr"+"ipt language=Javascript src=scripts/mmenudom.js><\/scr"+"ipt>");
</script>
<script language=JavaScript src="scripts/menu_data.js" type=text/javascript></script>

...which is OK (I guess) for the first directory level, but nothing else. This code says, "start looking from where I am now for /scripts/". If you happen to be in /newsite/ that will work, but if you are in /tryagain/, /scripts/ is not next in line (which is where the code says to look).

Server-relative addressing will fix this...
Code:
<script language="Javascript" src="/acad/biol/newsite/scripts/milonic_src.js" type="text/javascript"></script>
<!--
<script language="Javascript">
if(ns4)_d.write("<scr"+"ipt language=Javascript src=/acad/biol/newsite/scripts/mmenuns4.js><\/scr"+"ipt>");      
else _d.write("<scr"+"ipt language=Javascript src=/acad/biol/newsite/scripts/mmenudom.js><\/scr"+"ipt>");
</script>
-->
<script language="Javascript" src="/acad/biol/newsite/scripts/menu_data.js" type="text/javascript"></script>

This way, regardless of where you are in the structure, the search for /scripts/ will always start at the root level of your site. Remember to adjust this accordingly if this path is not the final location of this site.

Note I have added a little "fluff" to the JS calls. This brings them more in line with W3C standards, and stops validation errors if you check your code that way.

You also need to upgrade your menu for further support. You are running 5.21, current is 5.33.

Syntax in your _data file needs some work as well...
Code:
aI("text=Bio Home;url=index.html;;status=Back to Main Page;separatorsize=1")

...should be...
Code:
aI("text=Bio Home;url=index.html;status=Back to Main Page;separatorsize=1;");

Note the removal of the double ;; after the url, and the close of the statement - ;"); .

All your aI statements need these fixes.

It's that first slash


Poster: gardenguy
Dated: Sunday July 25 2004 - 20:19:08 BST

Having been bad at this myself for some time and falling into the ../../ trap for way too long, I just recently implemented this menu system on a new site and was again struggling when finally, after all this time, the light went on !!! Start with the /(slash), Start with the /, repeat ad nauseum.
As John says
Quote:
the search for /scripts/ will always start at the root level of your site
One reason it can fool you is that sometimes you can get away without the slash, but only when you are calling from files at that high root level.
Anyway, once you get it, you wonder what you were thinking (NOT!) all this time.
Thanks
David

Menu path still not correct


Poster: TelMgr
Dated: Monday July 26 2004 - 18:33:10 BST

Thanks for your thorough reply. I've made the changes you suggested and the menu does not appear at all.

As I said in my original post, I' have tried various paths based upon earlier posts, and I just can't seemed to get it.

Would you mind taking another look?
http://www.mtholyoke.edu/acad/biol/newsite/


Poster: John
Dated: Monday July 26 2004 - 21:27:28 BST

Your paths are fine. What I'm seeing is a JS error. Your menu is calling style1, but you do not have that defined anywhere! You have only defined menuStyle.

Also, in your HTML, just before the mainmenu code, you have...
Code:
<script>

I'd make that...
Code:
<script language="Javascript" type="text/javascript">


Poster: TelMgr
Dated: Tuesday August 3 2004 - 17:36:58 BST

John,

I've gone back to ground zero and am still unable to properly specify a path. The only thing posted to the site now are the files that come with the menu. The *.js files are unchanged.

-Changed name of menu.htm to index.html Worked fine as long as *.js files remained in /newsite.
-Moved *.js files to folder called scripts and changed path to "scripts/*.js" and the menu worked.
-Cut and paste your server relative path from above and the menu does not appear. As an FYI, absolute reference (with full http://) does not work either.

I've been through this over and over. Any suggestions? http://www.mtholyoke.edu/acad/biol/newsite/


Poster: Maz
Dated: Wednesday August 4 2004 - 5:16:37 BST

I can't find it, whatever it is, I wonder if you need to download the latest and upload the three files again. src, nuns4 and dom, completely replacing the old ones. There is nothing to change.

maz


Poster: TelMgr
Dated: Wednesday August 4 2004 - 23:22:54 BST

Maz wrote:
I can't find it, whatever it is, I wonder if you need to download the latest and upload the three files again. src, nuns4 and dom, completely replacing the old ones. There is nothing to change.

maz


Maz,

Those files are v5.33, which I believe is most recent. All four files are in a sub-directory called "scripts". http://www.mtholyoke.edu/acad/biol/newsite/scripts/


Poster: Maz
Dated: Thursday August 5 2004 - 3:03:51 BST

Yes that's what I saw, but can't understand what's wrong.

So I suggested the most recent, I think its 37 or 38 now. The idea is that if something is not right it might correct it. Such as wrong file format, or errors uploading, or maybe hidden characters, I just thought that if you dropped in fresh files it might undo whatever went wrong because I can't see what is causing the problem.

I did check the paths they should be working.

maz


Poster: TelMgr
Dated: Thursday August 5 2004 - 14:20:46 BST

Maz wrote:
Yes that's what I saw, but can't understand what's wrong.

So I suggested the most recent, I think its 37 or 38 now. The idea is that if something is not right it might correct it. Such as wrong file format, or errors uploading, or maybe hidden characters, I just thought that if you dropped in fresh files it might undo whatever went wrong because I can't see what is causing the problem.

I did check the paths they should be working.

maz


I've just re-tried with version 5.39 and it still does not work. Thanks so much to you & John for your rapid, patient, and considered replies. At this point, I think I need to decide whether or not to live with all html files in the root or look for an alternative menu solution. Thanks again.