" elements $EItem: A string that decides what element to contain each nav item in, defaults to "li", which will output as "
  • " elements */ function RecursiveNav($DB, $Parent, $CurrentPage = "", $NavMap = array(), $EContainer = "ul", $EItem = "li") { echo "<".$EContainer.">"; foreach($DB->Query("SELECT * FROM navigation WHERE parent=:parent ORDER BY sequence", array("parent" => $Parent)) as $Item) { $ClassInj = ""; foreach($NavMap as $Key => $Value) { if(strtolower($Item["id"]) == strtolower($Key) || strtolower($Item["title"]) == strtolower($Key)) { if(fnmatch($Value, $CurrentPage, FNM_CASEFOLD)) { $ClassInj = "class='current'"; break; } } } echo "<".$EItem." ".$ClassInj.">".$Item["title"].""; if(count($DB->Query("SELECT * FROM navigation WHERE parent=:parent", array("parent" => $Item["id"]))) > 0) RecursiveNav($DB, $Item["id"]); echo ""; } echo ""; }