Advertisement
Guest User

Untitled

a guest
Feb 6th, 2016
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1. function defaultNav($title, $page) {
  2. $class = (strpos($_SERVER['REQUEST_URI'],$page) !== false) ? ' class="active"' : '';
  3. return '<li'.$class.'><a href="'.$page.'">'.$title.'</a></li>'.PHP_EOL;
  4. }
  5.  
  6. function menuBuilder($menuList) {
  7. foreach ($menuList as $title => $page) {
  8. echo defaultNav($title,$page);
  9. }
  10. }
  11.  
  12. $mainNav= array(
  13. 'Nav' => 'nav.php',
  14. 'Link One' => 'one.php',
  15. 'Link Two' => 'two.php',
  16. 'Link Three' => 'three.php',
  17. 'Link Four' => 'four.php',
  18. 'Link Four' => 'functions.php');
  19.  
  20. menuBuilder($mainNav);
  21.  
  22. menuBuilder($sidebarNav);
  23.  
  24. $navItems = array(
  25. array(
  26. "slug" => "index.php",
  27. "title" => "Home"
  28. ),
  29. array(
  30. "slug" => "team.php",
  31. "title" => "Team"
  32. ),
  33. array(
  34. "slug" => "contact.php",
  35. "title" => "Contact"
  36. ),
  37. array(
  38. 'slug' => 'company.php',
  39. 'title' => 'The company'
  40. // Dropdown item One
  41. array(
  42. 'slug' => 'about-us.php',
  43. 'title' => 'About us'
  44. // Third dropwon
  45. array(
  46. 'slug' => 'john-doe.php',
  47. 'title' => 'John Doe'
  48. )
  49. array(
  50. 'slug' => 'timothy-mcgee.php',
  51. 'title' => 'Timothy McGee'
  52. // And so far, yeah i know, we need to write a nice looking css for this.
  53. array(
  54. 'slug' => 'timothy-mcgee.php',
  55. 'title' => 'Timothy McGee'
  56. )
  57. )
  58.  
  59. )
  60. array(
  61. 'slug' => 'information.php',
  62. 'title' => 'Information'
  63. )
  64. )
  65. array(
  66. "slug" => "Contact.php",
  67. "title" => "Contact"
  68. )
  69. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement