Indicating current page on navigation bar

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.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Oct 30th, 2006, 14:53
masonbarge's Avatar
Highly Reputable Member
Join Date: Jan 2006
Location: Atlanta GA
Posts: 631
Thanks: 0
Thanked 0 Times in 0 Posts
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

Code: Select all
<li class="r"><a href="./search_category.php"><?php if ($b == 'search_category') echo '<img src="./../images_articles/redarrowleft.gif" class="redarrow" width="5" 
                   height="5" alt="arrow to health">'; ?><span class="i">By Category</span></a>
</li>
Styling is
Code: Select all
.redarrow {
height: 5px;
width: 5px;
float: left;
border: none;
padding: 5px 1px 0 0;
}
Yes I can hear Graham now, this should be a function. I'll get to it today. The graphic could be cooler, too. But the point here is not the code. The point is taking the trouble to implement this very simple extra for the user's convenience.

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:
Common mistakes include different types of navigation on the same site, a link to the current page on the current page (home page link on home page), . . .
I tried as an alternative changing the current page navigation button to "Home Page"* which functions quite well; it was something like
Code: Select all
<a href = '
<?php 
if ($p == 'index') { echo "index.php";} else {echo "sextoys.php";}
 echo '>';
if ($p == 'index') { echo "HOME PAGE";} else {echo "SEXTOYS";}
 ?>
'></a>
But I didn't like the way it looked, with the HOME PAGE button changing position on every screen and often buried in an illogical spot.


*(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)
Attached Images
File Type: gif redlight.gif (825 Bytes, 85 views)
File Type: gif Image1.gif (1.3 KB, 30 views)

Last edited by masonbarge; Oct 30th, 2006 at 14:55. Reason: clarity
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Oct 30th, 2006, 19:31
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Indicating current page on navigation bar

Quote:
Originally Posted by masonbarge View Post
(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)
That in itself is a no-no. That's consistency in navigation gone straight away if the user can't rely on where a certain link might be.

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Oct 30th, 2006, 20:40
Up'n'Coming Member
Join Date: Jan 2006
Location: East Sussex
Age: 27
Posts: 58
Thanks: 0
Thanked 0 Times in 0 Posts
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>";
}
}
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
navigation

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

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 17:54
highlight current page unitedcraig Web Page Design 53 Feb 13th, 2008 23:20
highlight the current page of a drop down menu Oak Web Page Design 2 Feb 12th, 2008 04:08
How to highlight the current page Nav link ? Oak Web Page Design 11 Jan 20th, 2008 14:21


All times are GMT. The time now is 09:40.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved