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

"here" image with dynamic url


Poster: jbreslow
Dated: Tuesday December 21 2004 - 19:51:58 GMT

How do I swap menu images when I am using a dynamic url?

I have an image that I am using in the menu that I would like to swap for a "here" image (here = the page or section the user is on). Because the url is dynamic it doesn't always match the url used in menu_data.js.

This works for the first page, but as soon as the URL changes, I get the incorrect image.
aI("url=index.cfm?curpage=main&course=path;status=Pathology;image=images/menu/pathology.gif;pageimage=images/menu/pathology_here.gif");

Working URL: /index.cfm?curpage=main&course=path
Not working URL: index.cfm?curpage=image_directory&course=path&lesson=2

As you can see by the URL's they are still in the Path course..."course=path" will be the variable used to determin which section they are in.

Thanks,
Josh


Poster: Ruth
Dated: Friday December 24 2004 - 6:01:34 GMT

Hi Josh,
Could you give a url so we can see what's happening and check the code? And perhaps edit the title of this post to something like pagematching/highlighting with dynamic urls or something like that. I'm sorry but I don't know anything about dynamic urls so I can't even try playing around to see if I can figure something out.

Merry Christmas

Ruth


Poster: jbreslow
Dated: Monday January 3 2005 - 16:35:23 GMT

Hi Ruth,

Here is the URL.

http://cfdev.ucsd.edu/medpics/

If you click on any link from the Path Home page you'll see that the 'Pathology' tab is no longer "active" or showing the correct image. The only way to tell which section you are in, Path, Heme or Hist is by the url variable, course=xxxx.

TIA,
Josh


Poster: Ruth
Dated: Monday January 3 2005 - 18:51:24 GMT

Hi Josh,
http://www.milonic.com/forum/viewtopic.php?p=21730

I don't know if this will help maybe give you a direction. I'm beyond my depth here, so, this may be totally out in left field ... have you tried pagematch? You can find a description of that at the itemproperties link below my signature.

One thing it doesn't discuss is using pagematch to match a directory. Let's say you have the directory medpics, in the aI string you'd put pagematch=whatever the url up to and including the directory. pagematch=cfdev.ucsd.edu/medpics/; Using that in the aI string would make any of the pages you reach from a link on that main pathology page show a pagematch IF they are in that directory.
Code:
aI("url=index.cfm?curpage=main&course=path;status=Pathology;image=pathology.gif;
pageimage=pathology_here.gif;pagematch=http://cfdev.ucsd.edu/medpics/");


I know that works, but again, I don't know the main&course=path stuff you have :? Hope that helps.

Ruth


Poster: jbreslow
Dated: Monday January 3 2005 - 23:19:04 GMT

for lack of a better solutions I did the following....

//set the variable 'curr_url' to equal the current url
curr_url = document.URL;

//use reg expresssions to find '&course=*'
course = curr_url.match(/&course\=[a-zA-z]+/i);

//okay ... now we have the &course = ... , so let us remove the 'course=' part so that we just have the value
course = course[0].replace(/&course\=/,"");

// if statement to determine which link/image to use
if(course == "path"){
aI("url=index.cfm?curpage=main&course=path;status=Pathology;image=images/menu/pathology_here.gif");
}
else{
aI("url=index.cfm?curpage=main&course=path;status=Pathology;image=images/menu/pathology.gif");
}