1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
<?php
if (!isset($nav_hide) || $nav_hide==false) {
if (!isset($path))
$path = $nav->getPathInfo($page);
$branchdepth = 2; // how much of the tree to show
if (preg_match("'.*/$'",$page->path))
$branchdepth--;
$depth = count($path);
echo("<div id=root>\n");
if ($page->path != '' || get('s')) {
echo "<div>" . img('triangle-up.png') . " " . alink('/',"Home","class=nav") . "</div>\n";
}
if ($depth > $branchdepth) {
$startlevel = $depth-$branchdepth;
$path = array_reverse($path);
while(count($path) > $branchdepth) {
$pathpart = array_pop($path);
echo("<div>" . img('triangle-up.png') . " " . alink($pathpart['path'] . '/',$pathpart['title'],"class=nav") . "</div>\n");
}
}
else {
$startlevel = 0;
}
echo("</div>\n");
$tree = $nav->getTree($page,$startlevel);
#debug($path);
echo "\n<div id='list'><ol>\n";
foreach($tree as $entry) {
echo (str_repeat(' ', $entry['level']+1));
if ($entry['level'] === 'push')
echo "<ol>\n";
elseif ($entry['level'] === 'pop')
echo "</ol>\n";
else {
$link = alink($entry['path'] . '/',$entry['title'],"class=nav");
if ($entry['selected']) $link = "<strong>$link</strong>";
echo "<li>$link</li>\n";
}
}
echo "</ol></div>\n";
#debug($tree);
if (!$robot) {
echo "<p><form action=\"$root\" method=get>search:<br><input name=s size=15 value=\"" . get('s') . "\"></form></p>";
}
}
?>
|