Skip to content

Instantly share code, notes, and snippets.

@tripflex
Created August 8, 2013 22:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tripflex/6189586 to your computer and use it in GitHub Desktop.
Save tripflex/6189586 to your computer and use it in GitHub Desktop.
menu sections
<?php
#count all sections and go through each one to create a menu
for ($i = 0; $i < count($sections); $i++) {
echo '<li'.($s == $sections[$i] ? ' class="current_page_item">' : '>');
echo '<a href="/'.$sections[$i].'"><span><strong>'.$sectionstitle[$i].'</strong><span class="navi-description">'.$sectionssubtitle[$i].'</span></span></a>';
echo '<ul class="sub-menu">';
# search through current section to build sub-menu items
$section = $sections[$i];
foreach ($$section as $submenukey => $submenuvalue){
echo '<li><a href="/'.$section.'/'.$submenukey.'"><span>'.$submenuvalue.'</span></a></li>';
}
echo '</ul></li>';
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment