Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

How can I indicate the current page?

( #27151=categorized question: print w/ replies, xml ) Need Help??
Contributed by rodry on Aug 09, 2000 at 23:08 UTC
Q&A  > CGI programming


Description:

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.

Answer: How can I indicate the current page?
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.

Answer: How to? Dynamic navigational bars.
contributed by rodry

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.:)

Please (register and) log in if you wish to add an answer



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

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

    How do I use this? | Other CB clients
    Other Users?
    Others making s'mores by the fire in the courtyard of the Monastery: (7)
    As of 2015-07-03 00:29 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









      Results (47 votes), past polls