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: Thursday February 8 2018 - 06:02:26

path puzzle in menu using images


Poster: Onionpeeler
Dated: Monday September 15 2003 - 12:14:49 BST

Hi to everyone...

I've got a puzzle for you all... I cant seem to get all the bits right at the same time so I would really appreciate if someone could go through this with me.

I have a site I'm developing on spec on a local Win2K box with no web server installed.
Its 3 levels deep.. by that I mean it has the following structure:

root (index.html)=> folder 1 => documentA.html
folder 2 => 2subfolder => documentB.html
folder 3
folder 4 => 4subfolder => documentC.html
images => gifs
menuimages => gifs
scripts => milonic scripts + embedmenu.js
style => style.css


I have the scriptpath variable in milonic_src.js uncommented and set to /root/scripts/

to avoid the browser printing the script code if it cant deal with javascript I call the menu from all the documents using:
<script src="/root/scripts/embedcontentmenu.js"></script> (this script also lives in the script folder alongside the milonic scripts).

the script contains the following parameters:

with(milonic=new menuname("test")){
style=menuStyle;
top=0;
left=0;
alwaysvisible=1;
orientation="vertical";
position="relative";
aI("image=menuimages/home.gif;url=http://www.domain.com/index.html;");
}
drawMenus("test");


This works for docs in the root directory
Now, in 2nd and 3rd level documents (documentA and documents B/C) in order to make the images appear, do I have to add an../ and ../../ in front of the path or is there another way?

I note that when I do add ../ or ../../ to the script the main menu images appear ok but my submenu images do not appear..I presume because these are called by the menudata script which would also need to have ../ and ../../ place in front of the path to the images (???)

can anyone help me with a strategy to make menu management in this directory structure a little bit more easy and if possible ready to load up to a server without having to edit all the code (I get the feeling that with ../ in some menus, if I have to set this up to work in a server I am going to be really lost)... I really am starting to loose track of all the loose ends, and dont know how to tighten this up. I've trawled the forums but really am still not sure which way to go.

All the best
The Onionpeeler


Poster: Hergio
Dated: Monday September 15 2003 - 13:29:55 BST

First, you keep saying /root/. I am unsure of your directory structure or its naming, but you dont need to say /root/, when you begin a URL with /, it assumes you mean to start looking from the root. Unless you have a directory called root, then you are fine....just want to be clear on that.

Secondly regarding URLs of images and menus, take a look at http://www.milonic.com/forum/viewtopic.php?t=2430&highlight=absolute+relative+url and you will see alot of explaining on this, hopefully it will guide you.


Poster: Onionpeeler
Dated: Tuesday September 16 2003 - 10:47:00 BST

Hi Dave...thanks for pointing me to that thread its got all the info I needed...
I seriously think that a distilled version of that thread should go in the faq...its the best way I've seen paths described...I finally got a handle on it as a result!! cheers!!

I put my the whole site in an empty virtual drive on my win2k hard disk (g:)..

top level.......................second level ................third level

index.html
folder1................... => documentA.html
folder2................... => 2subfolder ...............=> documentB.html
folder3
folder4......................=> 4subfolder..............=> documentC.html
images(folder) .......... => gifs
menuimages(folder) ..=> gifs
scripts(folder)............ => milonic scripts
style(folder) ............. => style.css


I changed the scriptpath variable in milonic_src.js to /scripts/

used ABSOLUTE URL syntax (eg: putting a / in front of the pathname to a page, and removing http://www.mydomain.com or any relative url syntax such as ../ or ../../
that way, in the menu scripts I see the following for a link to documentA I get:
url=/folder1/documentA.html
for a link to documentC.html I get:
url=/folder4/4subfolder/documentA.html
for a link to a menu image I get:
image=/menuimages/image.gif

links to scripts from the HTML code in a page:
(in the header)
<script language="JavaScript" src="/scripts/milonic_src.js" type="text/javascript"></script>
<SCRIPT language=JavaScript src="/scripts/menu_data.js" type=text/javascript></SCRIPT>

to point to a script from the body of the document
<script src="/scripts/scriptname.js"></script>

I am able to use the same code in any page...I can move those pages around to other levels and folders and they still work.

This means I can use templates :P which makes me one very happy onionpeeler!!

Thanks again

all the best


Poster: Hergio
Dated: Tuesday September 16 2003 - 12:45:37 BST

Onionpeeler, so glad you got a handle on it. It can be a tricky subject depending on the setup of the server, but once you got it, its very easy and is second nature as you can probably now atest to.

I have an idea, I will mention to andy about that.