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

Relative paths (/) works online, but not my local machine

Poster: scott.g
Dated: Friday October 21 2005 - 9:31:40 BST

Its been two weeks of trials and testing plus I have read a number of submissions on this topic and I hope I am not just another one whose not getting it, but I have no hair left.

In my example below, I need to be able to take the (2)MASTER DIRECTORY and place it on any medium. i.e

on the web, CD or Hard drive and have the system work when the (4) index.hml is executed. I cannot find a stable method for writing relative paths that works. I am using this for a training product.

The reason the index page is in the PRODUCT folder, is becuse there maybe many PRODUCT folders and the menu will have different links for each prodcut.

1 ROOT (Local Machine or web)
.......|...3 PRODUCT
.......|......|- 4 index.htm (contains the menu in a table)
.......|......|- 5 Menu_data.js
.......|...6 SUBJECT (folder contains lessons)
.......|...7 SUBJECT (folder contains lessons)
....8 XPMENU
..............|- 9 image(s).gif (every Image for menu)
..............|- 10 All.js (every .Js file used for menu)


:D A. THIS WORKS - in the (4)index.htm I refer to the (5)Menu_data.js by writing src="Menu_data.js" this works in all cases.

:( B. DONT WORK - in the (4)index.htm I refer to the images and other .js files in the (8)XPMENU folder by writing "/MASTER/XPMENU/...." works on the web but not on my local machine.

:( C. DONT WORK - in the (5)Menu_data.js file I refer to the (8)XPMENU folder by writing "/MASTER/XPMENU/...." this works on the web, but not on my local machine.

Its easy to make everything work with absolute paths, but Its then no good to download for a given machine, not knowing where it will go.

I really need some help with this, as I have to have it working on all mediums very soon.

Poster: kendra
Dated: Friday October 21 2005 - 19:05:44 BST

I had this problem too, I used document-root-relative path and it worked great, and solved all path issues.

The first thing to do is create a folder in the root of your local machine

example: C:\ menu\

Put all your menu resource files inside that folder. This will be the main resource folder for the menu.

If your local machine drive is partitioned, in you might need to use D:\

From your webpage just call the menu using the root-relative path


<!-- Start DHTML Menu------------------------------>
<script type="text/javascript" src="/menu/menu_data.js"></script>

Before you copy the folder to the server you have to edit the image path in menu_data.js and use the same document-relative path.



Now drag the folder onto your server in the root directory


There is a advantage to this method, it allows you to have one menu folder for the whole site, If you need to add/remove a item for example just edit the"/menu/menu_data.js" and all menus on every page are updated.

The starting / slash is the key, it points back at the root level, on your server its on your local its C:>\menu\

Now create a blank template page with just a menu, if you need to add a new page (or folder) on the site, just drop the template page on the site and add the content and since the menu will work automatically, now all you need to do is add the content for the page then edit


and add the new item to the menu and your done!

That worked perfect for us, and makes it much easier. The menu will work regardless how deep in the structure the page is on the site.

If you need special menu items, such as when admins are logged in, you can use a session variables and call a special menu_data.js.

header("Cache-control: private");

if( __at__ $_SESSION["user"]){}
else $menu  ("getfilecontents : /menu/admmenu_data.js");

If you elect this method, then you need to include a menu_config.php that has all your variables defined. When you call them





So the value in $menu_data might change depending on the session variable thats compared when the page loads.


Hope that helps ;)

still not working on my local machine

Poster: nig
Dated: Monday October 24 2005 - 20:01:56 BST

Thank you Kendra for these detailed step-by-step instructions. Just what I need.

Thing is - it still won't work on my local machine.

Can anyone see what I'm doing wrong?

It works fine on line at and

but off line these two pages have no menu at all.

I have a C:\menu folder and a C:\Documents and Settings\Nigel\My Documents\heal\new\web\menu folder, but neither will make it go.

I want to be able to use the menus off line as well as on.

Thank you

Poster: scott.g
Dated: Tuesday October 25 2005 - 1:01:11 BST

Hi Kendra and nig

Same for me. Kendra, thanks for your explanation. I had tried doing this with out the absolute path locally.
The fact that you have to write an absolute path when on your local machine cuases problems, becuase if you are going to use it as part of a package as I need to, I will not know where the end user is going to install it to.

I believe the way the code has been designed has limited its working in regards to the issue. I would love to see the milonic guys write it so it works in a typical fashion. i.e. the same way a graphic does on a html page.

I noticed that the menu_data.js file really struggles with paths outside of folders. It is happy to jump out of the folder you are in, up one level, but it wont jump into another folder unless that folder is on the root and uyou use the method you have suggested, but this does not work on my local machine.

If you or anyone has any more suggestions, would love to hear about it