+
+function printtoc($root)
+{
+ print '<ul>';
+ foreach (array_reverse(glob("$root/*.html")) as $page) {
+ $title = fgets(fopen($page, 'r'));
+ $title = strip_tags($title);
+ $linkurl = preg_replace('/\.html$/', '', $page);
+ printf('<li><a href="/%s">%s <small class="date">%s</small></a></li>',
+ $linkurl, $title, shownewsdate($linkurl));
+ }
+ print "</ul>\n";
+}