Advertisement
Guest User

Untitled

a guest
Jun 15th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.94 KB | None | 0 0
  1.  
  2. ```php
  3.     // the top level menu items are stored as an array
  4.     $menuItems = array(' href="index.php">Home',
  5.                        ' href="activities.php">Activities',
  6.                        ' href="about.php">About',
  7.                        ' href="profile.php">My Profile',
  8.                         ' href="#" class="icon" id="menuicon" onclick="toggleClass(\'topnav\', \'menuicon\')"><b>&equiv;</b>');
  9.    
  10.     // write the opening structure of the menu
  11.  
  12.     echo '<div id="topnav" class="menu">';
  13.     // write the individual menu items
  14.     $menuCount = count($menuItems);
  15.     for ($i = 0; $i < $menuCount; $i++) {
  16.         echo "\n<a";
  17.         if ($section == $i) { // if an item is selected, add the correct class spec
  18.             echo " class='selected'";
  19.         }
  20.         echo  $menuItems[$i] . "</a>";
  21.     }
  22.  
  23.     // write the closing structure of the menu
  24.     echo "\n
  25.        </div>";
  26. }
  27. ```
  28. That is where i build the menu
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement