From df00ab2b9618c2ae1038c643b01b05d443368ee9 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Mon, 3 Sep 2018 22:58:19 +0200 Subject: [PATCH] nieuws: toc view option to show headlines in placeholder Allows overview features to be specified by static templates, so pages can be dynamically customised. Track default html with all options enabled as before on melding. --- nieuws.php | 13 +++++++++++++ nieuws/index.html | 16 ++++++++++++++++ nieuws/index.php | 36 ------------------------------------ 3 files changed, 29 insertions(+), 36 deletions(-) create mode 100644 nieuws/index.html diff --git a/nieuws.php b/nieuws.php index 7127a54..2b0151d 100644 --- a/nieuws.php +++ b/nieuws.php @@ -2,8 +2,21 @@ include_once 'nieuws.inc.php'; $articles = (ltrim($Args, '/') ?: 'nieuws'); if (strpos($articles, '/') === FALSE) { + if (@$Place['view'] === 'toc') { + foreach (array_reverse(glob("$articles/2???")) as $page) { + $year = basename($page, '.html'); + printf('

%s

'."\n", $page, $year); + printtoc($page); + } + return; + } $articles .= '/????'; } + +if (@$Place['view'] === 'toc') { + printtoc($articles); + return; +} ob_start(); shownews($articles, @$Place['n'] ?: 5); print getoutput(); diff --git a/nieuws/index.html b/nieuws/index.html new file mode 100644 index 0000000..513237f --- /dev/null +++ b/nieuws/index.html @@ -0,0 +1,16 @@ + + +
+

Nieuwsarchief

+[[nieuws view=toc]] + +

Eerder

+[[nieuws view=toc nieuws/19??]] + +

Melding rapporteren

+[[contact subject=melding]] + +
+

+
+
diff --git a/nieuws/index.php b/nieuws/index.php index 468de28..b54d5bd 100644 --- a/nieuws/index.php +++ b/nieuws/index.php @@ -40,42 +40,6 @@ if ($year) { return 1; } -$html = ob_get_clean(); -printf(''."\n", - "/$Page/feed", - ' rel="alternate" title="Atom feed van nieuwsberichten" type="application/atom+xml"' -); -print $html; - -print '
'."\n\n"; - -foreach (array_reverse(glob("$Page/2???")) as $page) { - $year = basename($page, '.html'); - printf('

%s

'."\n", $page, $year); - printtoc($page); -} - -if ($pages = glob("$Page/19??/*.html")) { - printf('

%s

'."\n", "$Page/19", 'Eerder'); - printtoc($pages); -} - -print "
\n\n"; - -if ($replyform) { - print "

Melding rapporteren

\n"; - $_REQUEST['subject'] = 'melding'; - require 'contact.php'; -?> -
-

- - -

-
-'."\n"; } -- 2.30.0