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
Outside of code tags, you may need to use entities for some characters:
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
|
|