nieuws: placeholder script to show articles
authorMischa POSLAWSKY <perl@shiar.org>
Wed, 2 May 2018 15:05:18 +0000 (17:05 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Sat, 9 Jun 2018 03:18:59 +0000 (05:18 +0200)
Can replace homepage controller to inline latest news.

nieuws.inc.php
nieuws.php [new file with mode: 0644]
nieuws/index.php

index 3d88a263810e58205354a7459f65890fe64505a7..f4d42d8d82223a9b3898ca8a91abb6622e5ba390 100644 (file)
@@ -1,4 +1,5 @@
 <?php
+global $monthname;
 $monthname = ['?',
        'januari', 'februari', 'maart', 'april', 'mei', 'juni',
        'juli', 'augustus', 'september', 'oktober', 'november', 'december',
@@ -29,7 +30,7 @@ function shownewsarticle($url, $link = TRUE, $title = NULL)
        return preg_replace('{<h2>(.*?)</h2>}', $title, $html);
 }
 
-function shownews($root, $limit = 5)
+function shownews($root, $limit = 1000)
 {
        if (strpos($root, '/') === FALSE) $root .= '/*';
        foreach (array_reverse(glob("$root/*.html")) as $url) {
diff --git a/nieuws.php b/nieuws.php
new file mode 100644 (file)
index 0000000..83fdc7a
--- /dev/null
@@ -0,0 +1,4 @@
+<?php
+include_once 'nieuws.inc.php';
+$articles = ($Page ?: 'nieuws') . '/????/??';
+shownews($articles, @$_GET['n'] ?: 5);
index b28f72bbf406f556a124ebb02a9867a4b310aed7..bbc002a62eca92583b71832b729746faa01bc8f1 100644 (file)
@@ -24,7 +24,7 @@ if ($year) {
 
        print "<h2>$title</h2>\n\n";
        print '<div id="news">'."\n\n";
-       shownews($match, 100);
+       shownews($match);
        print "</div>\n\n";
        return 1;
 }