Guest User

menu

a guest
May 31st, 2016
72
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. <?php
  3. $current_page = basename($_SERVER['PHP_SELF']);
  4. $pages = array("index.php" => "Home","about.php" => "About", "contact.php" => "Contact");
  5. echo "<ul id='menu'>";
  6. foreach($pages as $key => $value){
  7. if($current_page == $key){
  8. echo "<li class='selected'> <a href='$key'> $value </a></li>";
  9. }
  10. else{
  11. echo "<li> <a href='$key'> $value </a></li>";
  12. }
  13. }
  14. echo "</ul>";
  15. ?>
RAW Paste Data