Mercurial > owls
view nav.inc.php @ 18:98983ba58e2e default tip
Added tag owls-2.0 for changeset 081ba8764994
author | markus schnalke <meillo@marmaro.de> |
---|---|
date | Sat, 23 Jul 2016 21:39:40 +0200 |
parents | 081ba8764994 |
children |
line wrap: on
line source
<ul id="nav"> <?php define('BASE', 'data/'); echo ' <li><a href="."'. (empty($_GET['path']) ? ' id="selected"' : '') .">Home</a></li>"; // build nav tree echo ' '. navtree("") ."\n"; ?> </ul> <?php /* recursive function creates the output for the nav tree */ function navtree($root) { if (!empty($root)) { $root .= '/'; } $files = scandir(BASE."$root"); $return = ''; foreach ($files as $f) { if (!is_dir(BASE."$root$f") || substr($f, 0, 1) == '.') { continue; } $return .= "<li><a href=\"?path=$root$f\"". ((isset($_GET['path']) && $_GET['path'] == "$root$f") ? ' id="selected"' : '') .">$f</a>"; $subtree = navtree("$root$f"); if (!empty($subtree)) { $return .= "<ul>$subtree</ul>"; } unset($subtree); } $return .= '</li>'; return $return; } ?>