<?php
///////////////////////////////////////////////////////
//    DESCRIPTION:
//    This file creates a menu structure that gives the
//    user a clue to their location in the site structure.        
//
//    One of the best known usability heuristics says you
//    should give the user feedback as to system state.
//    Their location, in my opinion, qualifies as system 
//    state. 
//
//    This file can help provide that location state
//    by doing two things: 1) NOT creating a link to the current
//    page and 2) Changing the CSS to create a visual cue of
//    current location within the site.
//
//    HOW IT WORKS:
//    This file is intended to be included on each page of
//    the website via php's include() function.
//
//    This file takes a hand-coded list of menu options,
//    (as the menu item title and the link destination) and
//    loops through them to create the menu.
//
//    During the loop, it compares the link destination with
//    the location of the current page and either creates a
//    link or does not create the link/ changes the CSS class
//
//    INSTRUCTIONS
//    The code below is well commented and pretty self-explanatory, 
//    so here's a brief summary:
//        1. Set up your array of options
//        2. Doublecheck the rest of the code below to see if 
//            my HTML matches your desired navbar. 
//        3. Change your site's CSS to include a class called "curr_loc"
//            to change the visual appearance of the current location.
//
//    Important:  My code below will generate an unordered list (<UL>).
//                In my opinion, a navbar is a list of nav options.
//                Others use <p> or even a table to generate their
//                navbar.  All ya gotta do below then, is change the
//                markup to match your site.
//                For information and examples on creating a good
//                navbar with CSS, go to:
//                http://css.maxdesign.com.au/listamatic/                
//
///////////////////////////////////////////////////////

// define the options in your navbar as shown below
// remember to include the "/" before each link.
// this is because the $current_url variable below will do so
// and the comparison is basically just a comparison between two
// strings of text.
$nav_options = array(
            
"Home" => "/index.php",
            
"Blog" => "/blog/index.php"
            
"News" => "/news/index.php",
            
"Resume" => "/resume/index.php",
            
"Past Work" => "/portfolio/index.php",
            
"Articles" => "/articles/index.php",
            
"Downloads" => "/programming/index.php",
            
"Links" => "/links/index.php"
            
);

// define our current location
$current_url $_SERVER['PHP_SELF']; 

// begin the navigation div and the top of the UL
print("<!-- begin menu include -->
<div id=\"navcontainer\">\n 
      <ul id=\"navlist\">\n"
);

// tabindex is set to "2" here, because my "skiplink" is set as "1"
// more information on a skiplink can be found at
// http://www.wac.ohio-state.edu/tutorials/section508/skipnav.htm
// more information on tabindex can be found at
// http://www.w3.org/TR/html401/interact/forms.html#adef-tabindex
$tabindex 2;

// start the loop to display the options
foreach($nav_options as $key => $val){
    
    
// if the destination is NOT the same as the current location, make a link                
    
if($val != $current_url){
         print(
"<li><a href=\"$val\" tabindex=\"$tabindex\">$key</a> </li>");
        
$tabindex++; // increment tabindex here
    
}
    
// otherwise, this means that the destination of the link is the same as current location
    // in which case we DO NOT want to create a link
    
else{
        print(
"<li class=\"curr_loc\">$key</li>");
    }
// clode the foreach loop

// close the navbar
print("</ul>");
print(
"</div><!-- end menu include -->");

?>