Current menu item - foreach
===

Consider this: 

        $menuItems = array (
	        "page1" => "1.php",
	        "page2" => "2.php",
	        "page3" => "3.php",
	        "page4" => "4.php",
	        "page5" => "5.php",
         );

and now I create the menu like this:

        <ul class="menu">
	        <?php 
	           foreach($menuItems as $name => $url) {
	           echo "<li><a href='$url' class='$class'>$name</a></li>";
	           } 
	        ?>
	    </ul>

Works great. But now I need to add a class .current on the current page.

To get the current page I do this:

          <?php 
             function curPageName() {
                return substr($_SERVER["SCRIPT_NAME"],strrpos($_SERVER["SCRIPT_NAME"],"/")+1);
             }
             $curpage = curPageName();
          ?>

And it also works great.

SO I guess the question is how do I assign $curpage to the ... current page? :)

Thank you.
Alex


