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

How can I indicate the current page?

by rodry (Beadle)
on Aug 09, 2000 at 23:08 UTC ( #27151=perlquestion: print w/replies, xml ) Need Help??

rodry has asked for the wisdom of the Perl Monks concerning the following question:

What is the most common, standard way of programatically implementing a navigational bar that indicates the visitor the are of the web site that they are looking at?

Thanks in advance.

Originally posted as a Categorized Question.

Replies are listed 'Best First'.
Re: How can I indicate the current page?
by PotPieMan (Hermit) on Aug 09, 2000 at 23:51 UTC

    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.

Re: How to? Dynamic navigational bars.
by rodry (Beadle) on Aug 09, 2000 at 23:23 UTC
    Update: Let's say a navigational toolbar as links A, B, and C. I want the link to A to turn bold when the user is viewing that area. Likewise, I want the link to B to turn bold when the user gets there, and so on.

    I thought this was done thru CGI. Then I read an article that implied that this could be done thru SSI alone.

    I was left wondering so I decided to ask which way to pros (like the visitors of these pages) prefer to do it.:)

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://27151]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (1)
As of 2021-09-28 01:09 GMT
Find Nodes?
    Voting Booth?

    No recent polls found