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
"here" image with dynamic url
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
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
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
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
Hi Josh,
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.
I know that works, but again, I don't know the main&course=path stuff you have
Hope that helps.
Ruth
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: Select all
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

Ruth
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");
}
//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");
}