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

Menu losing track of hyperlinks and images. How to fix?


Poster: vikenk
Dated: Wednesday December 7 2005 - 0:01:00 GMT

Hello all,

Having a little problem: I have some .htm files that are buried in a cuuple of layer of directories. These files are not showing the sub-menu indicator image and they seem to be losing track of the hyperlink structure. My common sense tells me that the following setup should work, but for some reason it doesn't. OK...

...all my menu files are in the root folder. The htm files in question are a couple of directory levels deep, for example: root/images/20th/20th_01.htm.

The header in the file 20th_01.htm looks like this:

<head>
<!-- MILONIC MENU SCRIPT -->
<script src="../../milonic_src.js" type="text/javascript"></script>
<script type="text/javascript">
if(ns4)_d.write("<scr"+"ipt language=JavaScript src=../../mmenuns4.js><\/scr"+"ipt>");
else _d.write("<scr"+"ipt language=JavaScript src=../../mmenudom.js><\/scr"+"ipt>"); </script>
<script src="../../menu_data.js" type="text/javascript"></script>
<!-- END MILONIC MENU SCRIPT -->
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
<title>20th Anniv 01</title>
<link rel="stylesheet" type="text/css" href="../../styles/pictures.css">
</head>

As you can see, all the header information points back to the menu files in the root directory. The menu *does* appear but the sub-menu image indicator doesn't appear and the hyperlinks are all wrong. The indicator image is in a folder called other_images. My menu_data.js file points to it:

subimage="other_images/tridown.gif";

Now, as long as the header information links back to where the menu files are, this should work, right? All the hyperlinks are off as well. When I hover the mouse over "Home" I see "images/2oth/home.htm", but home.htm is clearly in the root menu and should just be "home.htm"

I'm sorry, but I don't have a working page uploaded. I can't upload this one quite yet.

Is there a global command that I'm supposed to put in the menu_data.js file that tells it where its root directory is?

Thanks in advance for any answers.

Viken K.


Poster: Ruth
Dated: Wednesday December 7 2005 - 0:39:33 GMT

Hi,

We need a url. Just off the top of my head I'd have to say the path in the menu_data.js file for the subimages is incorrect. As to the links, again, without having the site to be able to see what's up we can only guess.

Ruth


Poster: vikenk
Dated: Wednesday December 7 2005 - 1:33:01 GMT

OK. I've got a working sample but I'm warning you, it's not pretty :>) I couldn't upload the css so it's quite unfinished, but the menu works.

Go to http://www.sayatnova.com/home_05.htm

You can see the menu works, all is OK. From the menu go to Pictures-->Social Events-->Alumni Reunion. Again, the menu works. Now click on the first picture (the stage). The menu appears, but no images. Now hover your mouse back over the "home" on the menu. You'll see that it doesn't point to "home_05.htm" but to /images/20th/home_05.htm

You'll have to follow the exact path I set because those are the only links that are active in this sample.

Incidentally, you'll notice that when you first click on the thumbnail and the image loads, a large white bar will appear on the bottom of the page. When you reload, it disappears. I suspect that it's the hidden Milonic Div, but I'm not sure.

Thanks for replying, Ruth.


Poster: Ruth
Dated: Wednesday December 7 2005 - 4:15:35 GMT

The path to the images in the menu_data.js file is incorrect. When you are at the 20th_01_05 page, if you put in that other_images/tridown.gif it will tell you page not found, because it's not under /images/20th/other_images/ etc. It's back at the root folder/other_images/

The same problem is happening with the Home at that point, because you have the url as just the page, so it's looking for the page at that place. For the homepage I always use the full path.


As to the bar I didn't notice it, but the Link back to Milonic is not supposed to be hidden if you're using a free licensed version of the menu. It must be visible and be on all pages that use the menu.

One thing I did, by the way, because I kept getting image problem is put all the menu files into one folder with all the menu images and subimages in the same folder. You might try that and see if it solves the problem.

Ruth


Poster: vikenk
Dated: Wednesday December 7 2005 - 4:44:39 GMT

Thanks for replying Ruth,

As a rule of thumb then, I should always use the full path in the menu? So to link to the image file, I should use "http://www.sayatnova.com/other_images/tridown.gif" as opposed to just "other_images/tridown.gif" or "../other_images/tridown.gif"?

As far as the DIV goes: I will make a link back to Milonic when I"m ready to publish the site, but I do believe the <div> is hidden by default. Of course, you would know better than me :>)

In the "install.txt" file that comes with the menu download, you are instructed to put this in the head or body:

<script type="text/javascript" src="milonic_src.js"></script>
<div class=milonic><a href="http://www.milonic.com/">JavaScript Menu, DHTML Menu Powered By Milonic</a></div>
<script type="text/javascript">
if(ns4)_d.write("<scr"+"ipt type=text/javascript src=mmenuns4.js><\/scr"+"ipt>");
else _d.write("<scr"+"ipt type=text/javascript src=mmenudom.js><\/scr"+"ipt>");
</script>
<script type="text/javascript" src="menu_data.js"></script>

I put the script in the <head>, but I kept failing validation because there was a <div> in the <head> so I moved it out into the <body>. It is unseen, though. If you look in the "milonic_src.js file, you'll see this:

<style>.milonic{width:1px;visibility:hidden;position:absolute}</style>

I guess it's supposed to be hidden? In either case, I will provide a link as the first item in the fineprint in the bottom of the home page. If you'd like to see the page as it currently is, go to http://www.sayatnova.com.

I'm working on a site redesign that will remove all the frames and go with a frameless design, and it all starts with this menu :>) I'd really like to reproduce the look of my current menu, with each menu item having a shadow. Not sure if it's possible, though.

Anyway, thanks for the advice!

Viken K.


Poster: vikenk
Dated: Wednesday December 7 2005 - 5:09:42 GMT

I've just been thinking for a bit. Isn't there a way to tell the menu where the root directory of the website is?

Putting the full path to the image or to the hyperlinks in the menu_data.js file means that I'll always be working off the actual published website. When I'm updating the website on my computer, then, I'll have to change the links to the local webpages then change them all back to the full path when I'm ready to publish? That doesn't seem to make sense, or maybe I'm misunderstanding you.

In html/internet speak, doesn't "../" mean "back to the root folder"? Even though my htm file (in this case) is in the "../images/20th" folder, I've linked back to the menu by stating that the menu is actually in the root folder with this statement:

<script src="../../menu_data.js" type="text/javascript"></script>

So shouldn't the menu know that it's in the root folder and adjust its images and hyperlinks accordingly? As an example, I don't have to put the full path in when I link to my stylesheet, just "../../styles/pictures.css" is enough. I guess I assume it's the same with the menu.

I hope I'm making sense here, and not totally comfusing you :>)

Viken K.


Poster: vikenk
Dated: Wednesday December 7 2005 - 13:55:23 GMT

According to the Menu FAQ, just typing /images/image.gif should work. Preceding the path with a font-slash should tell the menu so start from the root directory but so far, that hasn't worked for me.

http://www.milonic.com/menufaq.php#imgprob1

Viken K.


Poster: John
Dated: Wednesday December 7 2005 - 14:26:56 GMT

vikenk wrote:
In html/internet speak, doesn't "../" mean "back to the root folder"?

No, it doesn't. It means back up 1 directory level; ../../ means back up 2 levels, etc.

It turns into a real mess very quickly, especially if you have a deep site.

So, the best way to handle this is by using server-relative pathing, which is what you were eluding to. I would suggest putting your menu files in a root-level directory called /js/, and all menu-related images in another called /menu_images/.

Now, regardless of what level you are at in your site, calls to the menu code files would be /js/milonic_src.js/, etc., and images to /menu_images/image.gif/, etc. Obviously you can make these anything you want, but the key is having the directories at the root level and using a leading / in your calls.


Poster: vikenk
Dated: Wednesday December 7 2005 - 18:17:28 GMT

Hi John,

I gave what you suggested a try and it still doesn't seem to work. I'm frustrated. I must be doing something wrong. I setup a webpage with screen-shots if you want to take a look.

http://www.sayatnova.com/menu.htm

This is a menu system with such great design and such great flexibility. I can't image the designers made such a *huge* oversight with the non-intuitive directory design. I have to believe that there's a global command or variable that tells the menu which directory it's in and whether or not it's the root.

If the menu is in a folder, it should know which folder it's in with respect to the root and adjust hyperlinks accordingly.

I don't want to have to put duplicate copies of the menu files with different sets of links in every folder...

Thanks.

Viken K.


Poster: vikenk
Dated: Thursday December 8 2005 - 16:11:01 GMT

John, Ruth,

Have you had a chance to look at the webpage I setup in my previous post?

I hate to be a pest, but I'm really at a point here where I have to decide which way to go. It seems like my options are:

1) Totally change the structure of the website and the way I organize files in the website. I'll have to reorganize in a way that there are no htm files in any other folder except the root folder of the website.

2) Look for an alternate menu script.

I don't want to do #2 because I really like this menu script, but if I can't solve the hyperlink/image problem, I may have to. It seems like the menu assumes that whatever folder an htm file is in is the root folder. It seems to have no concept of where it is in the heirarchy.

I could probably just put the full path as the hyperlink, but this causes two problems:

1) I won't have a working local copy of the site (on the hard drive) since all the links would point to the published copy on the internet.

2) Some of the sites use frames. How could I use the full path of only the contents of one frame change?

Thanks a lot for your input. I really need to get this solved.

Thanks a lot.

Viken K.

<MY SOLUTION> Menu losing track of hyperlinks and imag


Poster: vikenk
Dated: Friday December 9 2005 - 15:58:40 GMT

Hello everyone,

Well, I found a relatively simple solution to my problem. It may not be the best fix, but it allows me to use the menu and not have to totally redesign the website structure.

I created a duplicate menu_data file with adjuted hyperlinks. So far, it's worked very well on my local copy of the website.

In the website I working on, most of the core htm files are in the root folder. All the picture files (the site is somewhat picture-based) are located in their repective folder two levels deeper, for example: /images/folder01/pic01.htm, /images/folder02/pic01.htm, etc.,

Since all the pictures are in the same level of the site, I created a duplicate menu_data file and called it menu_dtat_pics.js. All the info in the file is the same except that the links have been adjusted to ../../home.htm, etc.

For me this was an easy solution because of the structure of the site. If I had more htm files scattered in many different folders at many different levels, this would not have been very feasible. But...it works for me.

Maintenance should not be much of a problem since the menu doesn't change much and adding one or two items will not be uch of a hassle.

Just a temp solution untul Milonic updates the menu. Maybe they could add a global variable that says rootfolder="blahblahblah". That way you can tell the menu where it's starting point is in the hyperlink structure.

Thanks for taking the time to offer support!

Viken K.