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

Absolute vs. Relative Links


Poster: stephen702
Dated: Tuesday February 17 2004 - 3:23:15 GMT

I've been using the Milonic menu as the home page menu only. On other pages, I've linked back to the home page. Now, I'd like to put the Milonic menu on all pages.

My website has several subdirectories. I have a menu_data.js file in the main directory folder, and want to link to it from pages in various subdirectories.

That hasn't worked, however. In order to get menus to display & link properly, I've had to create a second data file in the main directory that's linked from pages in a subdirectory (with ../ in front of all relative URLs), and a third data file that's linked from pages in a sub-subdirectory (with ../../ in front of relative URLs) . That's too complicated.

My question: Will it degrade performance, or slow page loading, if the menu_data.js file uses absolute links for all pages and images--as in the example below?

aI("text=Resource Roster;url=http://aact.org/members/rostersearch.html;image=http://aact.org/images/dot_gold.gif;status=Resource Roster;");

Or is there a better way? Any thoughts are appreciated.


Poster: Maz
Dated: Tuesday February 17 2004 - 4:05:18 GMT

I find it a bit confusing, but I had a similar problem at first but it works fine now.

I have a path of /1/2/menu_files.js

One path is /forum/ but it still has the same link /1/2/menu-files.js

It knows to go back and start from the root. There is no need for ...

Absolute links will work fine, but I find I don't need them anymore.

I'm not sure why you have a problem, perhaps putting the menu files in its own folder would help putting it down a level to /menu/menu_data.js
and /menu/images/menu.gif will help.

Regards,
maz


Poster: bobwill
Dated: Tuesday February 17 2004 - 13:38:29 GMT

Using your example, I am assume that your root directoy is http://aact.org/

Therefore to access other files that are either in the root directory or a sub-directory off of root your code would be.
aI("text=Resource Roster;url=/members/rostersearch.html;image= /images/dot_gold.gif;status=Resource Roster;");

If you had a file in the root directory then it would be, url=/myfile.html


Poster: John
Dated: Tuesday February 17 2004 - 14:32:04 GMT

An absolute link will work, and should not cause any performance problems, but it is quite restrictive. For instance, what if you need to move sites?

What Maz and Bob have outlined is called server-relative addressing, and is the way to go. All your URLs, including the menu JS calls, are written relative to the root server address. This way, regardless of how deep your site might go, the code remains the same.


Poster: stephen702
Dated: Wednesday February 18 2004 - 2:27:47 GMT

Thanks for all your suggestions. The relative linking via a path works well.