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: Archived Topics for the old Version 3.0 JavaScript Menu
Forum Topic: Click to view post
Last Updated: Thursday February 8 2018 - 06:02:35

Address Issue


Poster: bobwill
Dated: Sunday December 8 2002 - 19:05:55 GMT

I am having a problem with the menu and the url address of htm files.

The menu works fine as long as all the htm files are in the root directory. The root directory being "http://mywebpages.comcast.net/nationalsite"

From the "index" page the menu loads correctly and the url of each menu is correct, but once you click on a menu item to go to level below the root directoy i.e "http://mywebpages.comcast.net/nationalsite/2003/xxx.htm" that htm file loads fine, but the menu now shows that address of the menus items as "http://mywebpages.comcast.net/nationalsite/2003/2003/xxx.htm".
The only way out of this is to go back to the root (Home) page and start over. What is causing the menu to add the sub-directory to the path.


Poster: kevin3442
Dated: Tuesday December 10 2002 - 19:46:09 GMT

Bob,

Can you post a URL so we can see exactly what's going on and examine the code behind it?

Kevin


Poster: trytrix
Dated: Tuesday December 10 2002 - 19:49:44 GMT

Same issue as in topic "Subdirectory Menu Problem" !!

Trytrix


Poster: kevin3442
Dated: Tuesday December 10 2002 - 20:28:44 GMT

Duh... sorry. I guess those were actual URLs and not just examples. Silly me.

The problem is your use of relative paths. You are often specifying a path relative to the current document's location. Take your "Tournament Sites" menu for example. The "Scores & Statistics" menu item is defined as follows:

Code: Select all

,"Scores & Statistics","2003/confstat.htm",,,1

That'll work from the top level (Home page), because the 2003 directory is a subdirectory of your root location, http://mywebpages.comcast.net/nationalsite. But once you're viewing http://mywebpages.comcast.net/nationalsite/2003/confstat.htm, you are already in http://mywebpages.comcast.net/nationalsite/2003/. So, the next time you select the same menu item, the browser wants to load confstat.htm from the 2003 subdirctory of where the current document is, i.e., http://mywebpages.comcast.net/nationalsite/2003/2003/confstat.htm, which doesn't exist.

(1) Try using a "/" in front of your directory names.

(2) Alternatively, specify a base directory path in a <base> tag within the <head> section of each document.

I'd try option 1 first, since the editing is easier.

Hope that helps,

Kevin


Poster: bobwill
Dated: Tuesday December 10 2002 - 21:26:11 GMT

Alright, thanks Kevin. I got it to work. Here is what I did. Maybe some else can profit from my learning curve. I set up a variable inside of the "menu_array.js" file and I defined it just ahead of the variable that defines // The time delay for menus to remain visible. I defined my variable as:

var baseurl="http://mywebpages.comcast.net/nationalsite/";

which is my base url.


Then in each of the submenu items that point to a sub directory I used the variable "baseurl" in the following manner:

,"Scores & Statistics",baseurl+"2003/confstat.htm",,,1

Everything seems to work OK now.

Thanks again Kevin for your wisdom.


Poster: bobwill
Dated: Tuesday December 10 2002 - 21:37:58 GMT

I spoke to soon. Every thing works fine as long as I stay within the "2003" subdirectory, if I go to another top menu, it thinks that it is in the "2003" directory.


Poster: bobwill
Dated: Tuesday December 10 2002 - 23:02:41 GMT

OK, got it fixed. just added the variable to all my links. I guess if you go to a subdirectory, then you need to have all links need to have the full path of the link. Using a "variable" is the easiest way.


Poster: kevin3442
Dated: Wednesday December 11 2002 - 6:28:50 GMT

Good idea Bob. But just curious... did you try just using a "/" at the beginning of your paths? Didn't work?

Kevin


Poster: bobwill
Dated: Wednesday December 11 2002 - 12:58:05 GMT

I did try it before I started asking for help. It did not work. When I used the "variable" just for those links under Tournament Sites, they worked, but the other main menu items also were affected, so I had to add the "variable" to all links throughout the menu. Once you load the menu system from a sub directory, it causes all links within your menu to have wrong address.