<?php

///////////////////////////////////////////////////////
//    1.Define menu as a nested array
//    2. Find current url using $_SERVER['PHP_SELF'];              
//    3. Use for loops to loop through array and output list items checking each loop to see if url is 'current'.
//         If url is current, delink and add <strong title="you are here"> element
//    4. only open branch (sub) menu if current page is child of branch
///////////////////////////////////////////////////////



// define menu using nested arrays:
include("includes/nav_array.php");



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

// begin menu list

print("<!-- begin menu include -->

      <ul >\n"
);
      


    
for ( 
$i=0$i count($menu); $i++)  // loop through first level navs
                

                 if (
$menu[$i]['url'] == $current_url// check if current
                                                        

                                                        echo 
"<li class=\"current ".$menu[$i]['class']."\"><strong title=\"You are here\">"$menu[$i]['text']."</strong>" ;
                                                        } 
                                                        else 
                                                        {
                                                        
//check if parent
                                                        
                                                        
if (is_array($menu[$i]['subMenu']) && $menu[$i]['text'] ==$section)
                                                            {
                                                            
$classParent" class=\"parent\"";
                                                            }
                                                        else
                                                            {
                                                             
$classParent"";
                                                            }
                                                        echo 
"<li class=\"".$menu[$i]['class']."\"><a".$classParent." href=\"" $menu[$i]['url'] . "\">" $menu[$i]['text'] . "</a>";
                                                        
                                                        
                                                        
                                                        }
                                                        
                 
                
                 
//print_r($menu[$i][$section]); // debugger to see what's in array
        
        
                        
if  ( is_array($menu[$i]['subMenu']) && $menu[$i]['text'] ==$section// check for sub menu
                            
                            
{
                             include(
"includes/submenu.php");
                            } 
// end sub menu if
                        
                        
else {
                        
                             echo 
"</li>\n";
                             
                             } 
// close first level list element
                        
                 
        
            
}// end navs first level loop
     
echo "</ul>\n"// close menu


?>