owls

view nav.inc.php @ 17:081ba8764994

The wiki-like system became a content-rendering system This is a single changeset to include all the changes throughout the last years. Owls no longer supports editing pages but only renders them. Also, it no longer uses a database to store the contents but reads the contents from the filesystem. All this made owls simpler ... anyway, it just reflects my needs.
author markus schnalke <meillo@marmaro.de>
date Sat, 23 Jul 2016 21:39:17 +0200
parents Nav.inc.php@3e3fa7725abb
children
line source
1 <ul id="nav">
3 <?php
5 define('BASE', 'data/');
7 echo ' <li><a href="."'. (empty($_GET['path']) ? ' id="selected"' : '') .">Home</a></li>";
8 // build nav tree
9 echo ' '. navtree("") ."\n";
10 ?>
13 </ul>
15 <?php
19 /* recursive function creates the output for the nav tree */
20 function navtree($root) {
22 if (!empty($root)) {
23 $root .= '/';
24 }
25 $files = scandir(BASE."$root");
26 $return = '';
27 foreach ($files as $f) {
28 if (!is_dir(BASE."$root$f") || substr($f, 0, 1) == '.') {
29 continue;
30 }
31 $return .= "<li><a href=\"?path=$root$f\"". ((isset($_GET['path']) && $_GET['path'] == "$root$f") ? ' id="selected"' : '') .">$f</a>";
32 $subtree = navtree("$root$f");
33 if (!empty($subtree)) {
34 $return .= "<ul>$subtree</ul>";
35 }
36 unset($subtree);
37 }
38 $return .= '</li>';
39 return $return;
40 }
42 ?>