From: Mischa POSLAWSKY Date: Thu, 19 Apr 2018 16:03:33 +0000 (+0200) Subject: nieuws: port excelsior toc and year filtering X-Git-Tag: v3.0~12 X-Git-Url: http://git.shiar.net/minimedit.git/commitdiff_plain/328e964708c7e9dc479a25f9358b2d03e9d7f66c nieuws: port excelsior toc and year filtering --- diff --git a/nieuws.inc.php b/nieuws.inc.php index ca16b4a..7e723e4 100644 --- a/nieuws.inc.php +++ b/nieuws.inc.php @@ -32,7 +32,8 @@ function shownewsarticle($url, $link = TRUE, $title = NULL) function shownews($root, $limit = 5) { - foreach (array_reverse(glob("$root/*/*.html")) as $url) { + if (strpos($root, '/') === FALSE) $root .= '/*'; + foreach (array_reverse(glob("$root/*.html")) as $url) { print "
"; ob_start(); include $url; @@ -42,3 +43,16 @@ function shownews($root, $limit = 5) if (--$limit <= 0) break; } } + +function printtoc($root) +{ + print '\n"; +} diff --git a/nieuws.php b/nieuws.php index 157986c..84a6172 100644 --- a/nieuws.php +++ b/nieuws.php @@ -1,17 +1,33 @@ Nieuwsarchief\n\n"; +if ($year) { + ob_clean(); + print "

Nieuws $year

\n\n"; + + print '
'."\n\n"; + shownews("$Page/$year/??", 100); + print "
\n\n"; + + return 1; +} print '
'."\n\n"; -shownews($Page, 20); + +foreach (array_reverse(glob("$Page/2???")) as $page) { + $year = basename($page, '.html'); + printf('

%s

'."\n", $page, $year); + printtoc("$page/??"); +} + print "
\n\n"; if (!empty($User['admin'])) {