'; $sec = (string) get_parameter ('sec'); $sec2 = (string) get_parameter ('sec2'); echo ''; foreach ($menu as $mainsec => $main) { if ($mainsec == 'class') continue; if (! isset ($main['id'])) { $id = 'menu_'.++$idcounter; } else { $id = $main['id']; } $submenu = false; $classes = array (); if (isset ($main["sub"])) { $classes[] = 'has_submenu'; $submenu = true; } if (!isset ($main["refr"])) $main["refr"] = 0; if ($sec == $mainsec) { $classes[] = 'selected'; } else { $classes[] = 'not_selected'; } $output = ''; if (! $submenu) { $main["sub"] = array (); //Empty array won't go through foreach } $submenu_output = ''; $selected = false; $visible = false; foreach ($main["sub"] as $subsec2 => $sub) { //Set class if ($sec2 == $subsec2 && isset ($sub[$subsec2]["options"]) && (get_parameter_get ($sub[$subsec2]["options"]["name"]) == $sub[$subsec2]["options"]["value"])) { //If the subclass is selected and there are options and that options value is true $class = 'submenu_selected'; $selected = true; $visible = true; } elseif ($sec2 == $subsec2 && !isset ($sub[$subsec2]["options"])) { //If the subclass is selected and there are no options $class = 'submenu_selected'; $selected = true; $visible = true; } else { //Else it's not selected $class = 'submenu_not_selected'; } if (! isset ($sub["refr"])) { $sub["refr"] = 0; } if (isset ($sub["type"]) && $sub["type"] == "direct") { //This is an external link $submenu_output .= '
  • '.$sub["text"]."
  • "; } else { //This is an internal link if (isset ($sub[$subsec2]["options"])) { $link_add = "&".$sub[$subsec2]["options"]["name"]."=".$sub[$subsec2]["options"]["value"]; } else { $link_add = ""; } $submenu_output .= ''; $submenu_output .= ''.$sub["text"].''; $submenu_output .= ''; } } //Print out the first level $output .= '
  • '; $output .= ''.$main["text"].'toggle'; if ($submenu_output != '') { //WARNING: IN ORDER TO MODIFY THE VISIBILITY OF MENU'S AND SUBMENU'S (eg. with cookies) YOU HAVE TO ADD TO THIS ELSEIF. DON'T MODIFY THE CSS if ($visible || in_array ("selected", $classes)) { $visible = true; } $output .= ''; } $output .= '
  • '; echo $output; } echo ''; //Invisible UL for adding border-top echo ''; } ?>