3 'januari', 'februari', 'maart', 'april', 'mei', 'juni',
4 'juli', 'augustus', 'september', 'oktober', 'november', 'december',
7 function shownewsdate($url)
9 $parts = pathinfo($url);
10 $year = pathinfo($parts['dirname'], PATHINFO_FILENAME);
11 @list ($month, $day) = explode('-', $parts['filename'], 3);
13 return sprintf('<small class="date">%s %s %s</small>',
14 intval($day), $monthname[intval($month)], $year);
17 function shownewsarticle($url, $link = TRUE, $title = NULL)
19 $html = ob_get_clean();
20 $date = shownewsdate($url);
26 $link ? '<h3><a href="/%2$s">%s</a></h3>' : '<h2>%s</h2>',
27 getoutput([1 => ' <small class="date">'.$date.'</small>']),
28 preg_replace('/\.html$/', '', $url)
30 return preg_replace('{<h2>(.*?)</h2>}', $title, $html);
33 function shownews($root, $limit = 5)
35 if (strpos($root, '/') === FALSE) $root .= '/*';
36 foreach (array_reverse(glob("$root/*.html")) as $url) {
40 print shownewsarticle($url);
41 print "</article>\n\n";
43 if (--$limit <= 0) break;
47 function printtoc($root)
50 foreach (array_reverse(glob("$root/*.html")) as $page) {
51 $title = fgets(fopen($page, 'r'));
52 $title = strip_tags($title);
53 $linkurl = preg_replace('/\.html$/', '', $page);
54 printf('<li><a href="/%s">%s <small class="date">%s</small></a></li>',
55 $linkurl, $title, shownewsdate($linkurl));