Advertisement
cafreak

Navigation Bar #2

Nov 11th, 2014
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.83 KB | None | 0 0
  1. <?php
  2.  
  3.     $links = array(
  4.                 "index.php" => "Welcome",
  5.                 "install.php" => "Installer",
  6.                 "admin.php" => "Create your Admin Account",
  7.                 "done.php" => "Finish"
  8.             );
  9.    
  10.     $navigationbar = "";
  11.        
  12.         //this function is located somewhere else in my script!
  13.         function get_page(){
  14.         $curPage = $_SERVER["REQUEST_URI"];
  15.         $curPage = str_replace("/forum/install/", "", $curPage);
  16.         return strtolower($curPage);
  17.     }
  18.    
  19.         foreach($links as $key => $value){
  20.         $selectionState = "unselected";
  21.                
  22.         if($key == get_page()){
  23.             $selectionState = "selected";
  24.         }
  25.        
  26.         if($navigationbar != ""){
  27.             $navigationbar = $navigationbar."\r\n<li class=\"$selectionState\"><a href=\"$key\">$key</a></li>";
  28.         }else{
  29.             $navigationbar = "<li class=\"$selectionState\"><a href=\"$key\">$key</a></li>";
  30.         }
  31.     }
  32.  
  33. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement