This is a discussion on "Indicating current page on navigation bar" within the PHP Forum section. This forum, and the thread "Indicating current page on navigation bar are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Indicating current page on navigation bar
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
||||
|
Indicating current page on navigation bar
Something that a majority of websites don't do, and should, is to show some sort of indication on the navigation if one of the nav. tabs refers to the current page. This is a small annoyance but completely unnecessary.
I made a little "red light" .gif, just 5x5px. This shows up like an LED. (Attachment 1). Then I just stuck a row of "if" clauses in the header.inc
Now if the user goes to click on the link to the page he's already on, he sees (Attachment 2). ![]() I've looked at quite a few design sites and most of them cite this as a mistake: linking to the current page. E.g. from Webapges That Suck: Quote:
*(if that wasn't clear, I had like 9 navigation buttons on the home page linked to non-home-page locations; when you went to one of those pages, the button that was previously the navigation to that page would change into a button for the home page) Last edited by masonbarge; Oct 30th, 2006 at 13:55. Reason: clarity |
|
|
|
|||
|
Re: Indicating current page on navigation bar
Quote:
I use a system whereby I grey out the text and remove the hyperlink capability all in one go. A function checks a page id for a match in the navigation and if found replaces the <a> node with a <span> node with the same text. As the css has an 'li span' style defined, this style is automatically applied. Everything happens automatically, you just have to adopt a regime for adding an id to your page that matches with your navigation. |
|
|||
|
Re: Indicating current page on navigation bar
Here's another way,
function fillMenuItems() { //array of menu items key is the display $menuItem['Page 1 display name'] = '/index.php'; $menuItem['page 2 display name'] = '/page2.php'; foreach($menuItem AS $menuName => $menuFile){ if($_SERVER['PHP_SELF'] == $menuFile){ echo "<li class='r'><a href='$menuFile'><img src='./../images_articles/redarrowleft.gif' class='redarrow' width='5' height='5' alt='arrow to health'><span class='i'>$menuName</span></a> </li>"; }else{ echo "<li class='r'><a href='$menuFile'><span class='i'>$menuName</span></a> </li>"; } } } |
![]() |
| Tags |
| navigation |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Current page problems | unitedcraig | Web Page Design | 3 | Jun 10th, 2008 20:44 |
| After login: Redirect to page in history (Current - 2)... | skuliaxe | PHP Forum | 4 | Feb 20th, 2008 16:54 |
| highlight current page | unitedcraig | Web Page Design | 53 | Feb 13th, 2008 22:20 |
| highlight the current page of a drop down menu | Oak | Web Page Design | 2 | Feb 12th, 2008 03:08 |
| How to highlight the current page Nav link ? | Oak | Web Page Design | 11 | Jan 20th, 2008 13:21 |