Demo: Dynamic CF Navigation Menu with 'current page' marker

ColdFusion Navigation Menu Demo

Sometimes you just need a simple menu.

If your list is very long, making a link with a class and an id, typing the href value for each, and inserting the link text all by hand can get old. And then - how do you show which link is the current page?

Here we set up a simple list of url/text pairs, and then loop through that list to create our links.

Then - much like the popular javascript-based 'current page' menus - we look at the value of the link url, and the current page url (cgi.SCRIPT_NAME) - if they are the same, we have a winner. One other thing I find myself commonly wanting is a bit of special css on the first or last item in a list, so the code also assigns IDs to those links.

See the demo   See the code

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
blogcfc 5.9.1.002 by raymond camden
contact michael evangelista