annotate nav.inc.php @ 17:081ba8764994 owls-2.0

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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
3021ce32ee14 begin of using hg for owls
"Meillo r e t u r n s <meillo@marmaro.de>"
parents:
diff changeset
1 <ul id="nav">
3021ce32ee14 begin of using hg for owls
"Meillo r e t u r n s <meillo@marmaro.de>"
parents:
diff changeset
2
3021ce32ee14 begin of using hg for owls
"Meillo r e t u r n s <meillo@marmaro.de>"
parents:
diff changeset
3 <?php
2
ab74e95a8040 added display of broken nodes; Header and Footer in Owls.php now; added logos
"Meillo r e t u r n s <meillo@marmaro.de>"
parents: 0
diff changeset
4
17
081ba8764994 The wiki-like system became a content-rendering system
markus schnalke <meillo@marmaro.de>
parents: 13
diff changeset
5 define('BASE', 'data/');
0
3021ce32ee14 begin of using hg for owls
"Meillo r e t u r n s <meillo@marmaro.de>"
parents:
diff changeset
6
17
081ba8764994 The wiki-like system became a content-rendering system
markus schnalke <meillo@marmaro.de>
parents: 13
diff changeset
7 echo ' <li><a href="."'. (empty($_GET['path']) ? ' id="selected"' : '') .">Home</a></li>";
081ba8764994 The wiki-like system became a content-rendering system
markus schnalke <meillo@marmaro.de>
parents: 13
diff changeset
8 // build nav tree
081ba8764994 The wiki-like system became a content-rendering system
markus schnalke <meillo@marmaro.de>
parents: 13
diff changeset
9 echo ' '. navtree("") ."\n";
0
3021ce32ee14 begin of using hg for owls
"Meillo r e t u r n s <meillo@marmaro.de>"
parents:
diff changeset
10 ?>
3021ce32ee14 begin of using hg for owls
"Meillo r e t u r n s <meillo@marmaro.de>"
parents:
diff changeset
11
3021ce32ee14 begin of using hg for owls
"Meillo r e t u r n s <meillo@marmaro.de>"
parents:
diff changeset
12
3021ce32ee14 begin of using hg for owls
"Meillo r e t u r n s <meillo@marmaro.de>"
parents:
diff changeset
13 </ul>
3021ce32ee14 begin of using hg for owls
"Meillo r e t u r n s <meillo@marmaro.de>"
parents:
diff changeset
14
3021ce32ee14 begin of using hg for owls
"Meillo r e t u r n s <meillo@marmaro.de>"
parents:
diff changeset
15 <?php
3021ce32ee14 begin of using hg for owls
"Meillo r e t u r n s <meillo@marmaro.de>"
parents:
diff changeset
16
2
ab74e95a8040 added display of broken nodes; Header and Footer in Owls.php now; added logos
"Meillo r e t u r n s <meillo@marmaro.de>"
parents: 0
diff changeset
17
17
081ba8764994 The wiki-like system became a content-rendering system
markus schnalke <meillo@marmaro.de>
parents: 13
diff changeset
18
081ba8764994 The wiki-like system became a content-rendering system
markus schnalke <meillo@marmaro.de>
parents: 13
diff changeset
19 /* recursive function creates the output for the nav tree */
081ba8764994 The wiki-like system became a content-rendering system
markus schnalke <meillo@marmaro.de>
parents: 13
diff changeset
20 function navtree($root) {
0
3021ce32ee14 begin of using hg for owls
"Meillo r e t u r n s <meillo@marmaro.de>"
parents:
diff changeset
21
17
081ba8764994 The wiki-like system became a content-rendering system
markus schnalke <meillo@marmaro.de>
parents: 13
diff changeset
22 if (!empty($root)) {
081ba8764994 The wiki-like system became a content-rendering system
markus schnalke <meillo@marmaro.de>
parents: 13
diff changeset
23 $root .= '/';
081ba8764994 The wiki-like system became a content-rendering system
markus schnalke <meillo@marmaro.de>
parents: 13
diff changeset
24 }
081ba8764994 The wiki-like system became a content-rendering system
markus schnalke <meillo@marmaro.de>
parents: 13
diff changeset
25 $files = scandir(BASE."$root");
081ba8764994 The wiki-like system became a content-rendering system
markus schnalke <meillo@marmaro.de>
parents: 13
diff changeset
26 $return = '';
081ba8764994 The wiki-like system became a content-rendering system
markus schnalke <meillo@marmaro.de>
parents: 13
diff changeset
27 foreach ($files as $f) {
081ba8764994 The wiki-like system became a content-rendering system
markus schnalke <meillo@marmaro.de>
parents: 13
diff changeset
28 if (!is_dir(BASE."$root$f") || substr($f, 0, 1) == '.') {
081ba8764994 The wiki-like system became a content-rendering system
markus schnalke <meillo@marmaro.de>
parents: 13
diff changeset
29 continue;
081ba8764994 The wiki-like system became a content-rendering system
markus schnalke <meillo@marmaro.de>
parents: 13
diff changeset
30 }
081ba8764994 The wiki-like system became a content-rendering system
markus schnalke <meillo@marmaro.de>
parents: 13
diff changeset
31 $return .= "<li><a href=\"?path=$root$f\"". ((isset($_GET['path']) && $_GET['path'] == "$root$f") ? ' id="selected"' : '') .">$f</a>";
081ba8764994 The wiki-like system became a content-rendering system
markus schnalke <meillo@marmaro.de>
parents: 13
diff changeset
32 $subtree = navtree("$root$f");
081ba8764994 The wiki-like system became a content-rendering system
markus schnalke <meillo@marmaro.de>
parents: 13
diff changeset
33 if (!empty($subtree)) {
081ba8764994 The wiki-like system became a content-rendering system
markus schnalke <meillo@marmaro.de>
parents: 13
diff changeset
34 $return .= "<ul>$subtree</ul>";
081ba8764994 The wiki-like system became a content-rendering system
markus schnalke <meillo@marmaro.de>
parents: 13
diff changeset
35 }
081ba8764994 The wiki-like system became a content-rendering system
markus schnalke <meillo@marmaro.de>
parents: 13
diff changeset
36 unset($subtree);
081ba8764994 The wiki-like system became a content-rendering system
markus schnalke <meillo@marmaro.de>
parents: 13
diff changeset
37 }
081ba8764994 The wiki-like system became a content-rendering system
markus schnalke <meillo@marmaro.de>
parents: 13
diff changeset
38 $return .= '</li>';
081ba8764994 The wiki-like system became a content-rendering system
markus schnalke <meillo@marmaro.de>
parents: 13
diff changeset
39 return $return;
081ba8764994 The wiki-like system became a content-rendering system
markus schnalke <meillo@marmaro.de>
parents: 13
diff changeset
40 }
0
3021ce32ee14 begin of using hg for owls
"Meillo r e t u r n s <meillo@marmaro.de>"
parents:
diff changeset
41
3021ce32ee14 begin of using hg for owls
"Meillo r e t u r n s <meillo@marmaro.de>"
parents:
diff changeset
42 ?>