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

New User - Paths to lower level files


Poster: KS100004
Dated: Friday May 28 2004 - 1:50:52 BST

I'm just getting started with DHTML and have almost no experience with JavaScript, so here goes. I have the following path defined on a menu:

aI("text=Blooming Grove;url=/data/bloominggrove/index.htm;");

When I try and test this it looks for C:\data\bloominggrove\index.htm

Obviously this can't be found. I assumed that the rules would be the same as HTML and it would look in the lower level under its current folder. It seems that this is incorrect, can anyone help with this problem?

Thank you,
Kevin


Poster: John
Dated: Friday May 28 2004 - 4:38:14 BST

Is the path setup on your local machine exactly the same as it would be on the server? You are using server-relative addressing (which is good), but if the path on the local doesn't match where the files are actually located (taking into account the root level), you get what you got - so to speak.


Poster: KS100004
Dated: Friday May 28 2004 - 14:17:19 BST

Thank you for the reply.

Yes, the path is how it would appear on the server. So why does it have a problem on my local box?

Kevin


Poster: fredlongworthhighschool
Dated: Friday May 28 2004 - 14:42:35 BST

The url doesn't seem right to me. I would have thought it would be:

Code:
aI("text=Blooming Grove;url=data/bloominggrove/index.htm;");

if it's in a folder below your JS data folder, or

Code:
aI("text=Blooming Grove;url=../data/bloominggrove/index.htm;");


...if it's above.


Poster: KS100004
Dated: Friday May 28 2004 - 16:16:40 BST

Fred,

Perfect, that fixed it.

I guess the next question is why does the install.txt show:

The following is a sample menu that includes several menu items.

with(milonic=new menuname("mainmenu")){
style=myMenuStyle;
alwaysvisible=1;
left=10;
top=10;
aI("text=Home;url=/index.html;");
aI("text=About Us;url=/aboutus.html;showmenu=About Us;");
aI("text=Contact Us;url=/contactus.html;showmenu=contact;");
aI("text=Google;url=http://www.google.com/index.html;");
}

In order to build your menu up you could copy and paste the above, making
modifications as required.

Hence my mistake of placing "/" after the url= for a lower folder level.

Or do you need the "/" for individual files if they remain in the same level as the menu java?

Thank you,
Kevin


Poster: John
Dated: Friday May 28 2004 - 17:36:10 BST

A typical server (not local) setup is something like /www/htdocs/(all my site files here). So even though your URL is http://www.me.com/, the real server location of the files is in the /htdocs/ directory - invisible to all.

So, if you do indeed place all your site files in /htdocs/ on the server, saying aI("url=/index.html;etc.), the server will start looking for this file from its root level (http://www.me.com/). Add /images/ to the site and aI("image=/images/us.gif;etc.) would be the call.

Server-relative (the /) always starts from the top and works its way down. Leave out the / and that means start from whatever directory I am in now and either look here or work my way down from here (depending on how you have coded it).

One of the biggies with this is in a deep directory structure where you have to, say, get an image from /images/ way back at the top. Without server-relative you'd be knee-deep in ../../../../images until you found it. With server-relative it's just /images/, regardless of where you are.

That's why the local structure must exactly match the server structure for it to work locally.

Hope that made at least a little sense, 'cause I just got up.


Poster: stephen702
Dated: Friday May 28 2004 - 20:10:02 BST

The link syntax is probably only a bother to those of us who work off our own computer hard drives, and then upload changes to the server.

I can't use server paths for the files on my PC ("/new/index.html"), because it doesn't understand them. So I tried using relative links, like "new/index.html".

This worked fine on both my PC and on the server--as long as the menu was called from a page in the main directory. However, if the web page is in a subdirectory, I needed a separate menu_data.js file to take care of things.

Thus, in my menu_data2.js file (for pages in subdirectories), the above link would be changed to "../new/index.html". I also had to adjust for any images used in the menu. Cumbersome.

The only solution I know for my situation is to use an absolute link in all cases ("http://mysite.com/new/index.html"), so there need be only one menu_data.js file, no matter where the pages are located.