Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Answer: How can I indicate the current page?

by PotPieMan (Hermit)
on Aug 09, 2000 at 23:51 UTC ( #27178=categorized answer: print w/replies, xml ) Need Help??

Q&A > CGI programming > How can I indicate the current page? - Answer contributed by PotPieMan

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.

Log In?

What's my password?
Create A New User
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2020-09-19 08:55 GMT
Find Nodes?
    Voting Booth?
    If at first I donít succeed, I Ö

    Results (114 votes). Check out past polls.