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:14
Folder structure and file placement
Poster: sartzava
Dated: Sunday August 22 2004 - 21:46:45 BST
I am building my website offline right now, but I have a question about file placement.
I currently have the following structure for my site's files:
Main folder
Subfolder
Subfolder
Subfolder
I currently have to place all four of the menu files in each of these folders to get the menu to work on the pages in them. Is there a way to set up the menu to only require one set of files for the entire site?
Poster: John
Dated: Monday August 23 2004 - 3:05:34 BST
Yes, easily.
Let's assume a slight change in your folder structure...
Main folder
Menu
->Subfolder
->Subfolder
->Subfolder
Place at least the 3 menu code files in /menu/. The _data file can be there as well, or in your HTML. It depends on how you are designing your site. For now we'll assume the _data file is in /menu/ as well.
Your JS calls would now look like this...
Code:
<script language="javascript" src="/menu/milonic_src.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
if(ns4)_d.write("<scr"+"ipt language=javascript src=/menu/mmenuns4.js><\/scr"+"ipt>");
else _d.write("<scr"+"ipt language=javascript src=/menu/mmenudom.js><\/scr"+"ipt>");
</script>
<script language="javascript" src="/menu/menu_data.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
if(ns4)_d.write("<scr"+"ipt language=javascript src=/menu/mmenuns4.js><\/scr"+"ipt>");
else _d.write("<scr"+"ipt language=javascript src=/menu/mmenudom.js><\/scr"+"ipt>");
</script>
<script language="javascript" src="/menu/menu_data.js" type="text/javascript"></script>
This is server-relative addressing. Simply place this code on each of your pages, and the system will always look for the files in /menu/, regardless of your directory structure (assuming that /menu/ is at the same level as /Main folder/).
Poster: sartzava
Dated: Monday August 23 2004 - 5:05:36 BST
John,
Thank you for the insight! Another issue that arises is the actual links within the menu. If I am linking from a page in subfolderA and to a page in subfolderB, I would need the link to be "../subfolderB/foo.html". However, that same link from a page in the main folder would need to be "subfolderB/foo.html".
How do I make the menu work correctly for this issue? The only thing that I can figure is to designate separate menu_data.js files for each subfolder, which is exactly what I don't want to do.
- Joshua
Poster: John
Dated: Monday August 23 2004 - 14:58:33 BST
You're welcome!
Just to be picky, our diagram isn't exactly right. Should be...
Main folder
->Subfolder A
->Subfolder B
->Subfolder C
Menu
Now, use the same info I gave you above to create a server-relative path. In this case, /Main folder/Subfolder B/foo.html. This will always start looking from the server root, regardless of where it is located in your structure.