$base, "pos" => GetOptionalNavPosition(), "title" => GetSitePageField("ntitle"), "type" => "d", "content" => ScanSite($dir . $entry)); } else if ((ereg('\.php$', $base)) && (!ereg('\.inc\.php$', $base)) && ($base != "index.php")) { SetPage($dir . $entry); include ($dir . $entry); $tree[] = array("name" => basename($base, ".php"), "pos" => GetOptionalNavPosition(), "title" => GetSitePageField("ntitle"), "type" => "f"); } } if (!empty($tree)) { //Sort on name foreach ($tree as $val) $sorttree[] = $val["pos"] . "/" . $val["name"]; array_multisort ($sorttree, $tree); //Now, $tree is sorted on name } return $tree; } function FormatNavigation($tree, $branch, $level) { if (empty($tree)) return " "; $dirname = ""; for ($i=0; $i<$level; $i++) $dirname .= $branch[$i] . "/"; $string = "\n"; $firstline = 1; foreach ($tree as $entry) { if (($level == 0) && (!$firstline)) $string .= "\n"; else $firstline=0; $string .= "\n"; // if ($level == 0) if ($entry["type"] == "d") $string .= ""; else $string .= ""; $string .= "\n"; $anchor = AnchorTag($dirname . $entry["name"], $entry["title"]); if ($entry["type"] == "d") { $anchor = "" . $anchor . ""; if (($entry["name"] == $branch[$level]) && (!empty($entry["content"]))) $anchor .= "\n\n\n\n\n"; } $string .= "
 
" . GetBug() . " 
 " . FormatNavigation($entry["content"], $branch, $level+1); } $string .= "" . $anchor . "
\n"; return $string; } function DisplayNavigation($tree, $current) { $branch = split("/", ereg_replace('\.php$', "", $current)); echo FormatNavigation($tree, $branch, 0); } $included["Simpleweb/navigation.php"] = 1; } ?>