Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: How can I indicate the current page?

by PotPieMan (Hermit)
on Aug 09, 2000 at 23:51 UTC ( [id://27178] : note . print w/replies, xml ) Need Help??


in reply to How can I indicate the current page?

I'm not sure if I fully understand what you want your navigation bar to do.

On my web site (which I would link, but I'm serving it off a 28.8kbps modem), I wrote a script to generate my header. Contained within the script is a hash of navigation links that I want to display. For example:

my %links = ( "1" => ['/channels.shtml', 'channels'], "2" => ['/mp3s/', 'mp3s'], "3" => ['/fortune.shtml', 'fortune'] );
Then, when I am generating the navigation links, I get the request URI ($ENV{'REQUEST_URI'}) and compare it to the values of the anonymous array in the hash. If the path is the same, I bold the link. For instance:
foreach(sort keys %links) { if ($uri eq $links{$_}[0]) { print "<STRONG><A HREF=\"$links{$_}[0]\">$links{$_}[1] +</A></STRONG>"; } else { print "<A HREF=\"$links{$_}[0]\">$links{$_}[1]</A>"; } print " | "; }

Like I said, I don't know if this is what you wanted.