3 'januari', 'februari', 'maart', 'april', 'mei', 'juni',
4 'juli', 'augustus', 'september', 'oktober', 'november', 'december',
7 function shownewsdate($url)
9 if (!preg_match('</(\d{4})/(\d{2})/(\d{2})->', $url, $parts)) return;
11 return implode(' ', array_filter([
12 intval($parts[3]), $monthname[intval($parts[2])], $parts[1],
16 function shownewsarticle($url, $link = TRUE, $title = NULL)
18 $html = ob_get_clean();
19 $date = shownewsdate($url);
25 $link ? '<h3><a href="/%2$s">%s</a></h3>' : '<h2>%s</h2>',
26 getoutput([1 => ' <small class="date">'.$date.'</small>']),
27 preg_replace('/\.html$/', '', $url)
29 return preg_replace('{<h2>(.*?)</h2>}', $title, $html);
32 function shownews($root, $limit = 5)
34 if (strpos($root, '/') === FALSE) $root .= '/*';
35 foreach (array_reverse(glob("$root/*.html")) as $url) {
39 print shownewsarticle($url);
40 print "</article>\n\n";
42 if (--$limit <= 0) break;
46 function printtoc($root)
49 foreach (array_reverse(glob("$root/*.html")) as $page) {
50 $title = fgets(fopen($page, 'r'));
51 $title = strip_tags($title);
52 $linkurl = preg_replace('/\.html$/', '', $page);
53 printf('<li><a href="/%s">%s <small class="date">%s</small></a></li>',
54 $linkurl, $title, shownewsdate($linkurl));