login/pass: error messages below page title
[minimedit.git] / widget / nieuws.php
index 977357e5e572d4afff1d43b863f44caa0837c309..10e31a3c97b9f8fff0cab5469609035b85aedc2c 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 if (!function_exists('shownews')) {
-function shownews($input, $limit = 1000)
+function shownews($input, $limit = 1000, $abbr = FALSE)
 {
        if (!is_array($input)) $input = glob("$input/*.html");
        print "<div>\n";
@@ -17,9 +17,18 @@ function shownews($input, $limit = 1000)
                print '<div>';
                printf(
                        '<h3><a href="/%s">%s <small class="date">%s</small></a></h3>',
-                       $article->link, $article->title, $article->date
+                       $article->link, $article->title, showdate($article->dateparts)
                );
-               print $article->story;
+               if ($abbr) {
+                       print '<p>' . $article->teaser;
+                       if ($article->story != "<p>{$article->teaser}</p>\n\n") {
+                               print ' <small class="footer">(Meer op de site)</small>';
+                       }
+                       print "</p>\n";
+               }
+               else {
+                       print $article->story;
+               }
                print '</div>';
                print "</article>\n\n";
 
@@ -44,7 +53,7 @@ function printtoc($input, $class = FALSE)
                $html .= sprintf(' <small class="date">%s</small>', showdate($dateparts));
                if ($class == 'gallery' and $article->img) {
                        $html = "<div>$html</div>";
-                       $html = sprintf('<img src="%s" />', $article->thumb(200)) . $html;
+                       $html = sprintf('<img src="/%s" />', $article->thumb(200)) . $html;
                }
                $html = sprintf('<a href="/%s">%s</a>', $article->link, $html);
                print "<li><article>$html</article></li>\n";
@@ -53,9 +62,9 @@ function printtoc($input, $class = FALSE)
 }
 }
 
-$articles = (ltrim($Page->path, '/') ?: 'nieuws');
+$articles = $Page->place[0] ?? 'nieuws';
 if (strpos($articles, '/') === FALSE) {
-       if (@$Place['view'] === 'toc') {
+       if (@$Page->place['view'] === 'toc') {
                print "<div>\n";
                foreach (array_reverse(glob("$articles/2???")) as $page) {
                        $year = basename($page, '.html');
@@ -68,10 +77,11 @@ if (strpos($articles, '/') === FALSE) {
        $articles .= '/????';
 }
 
-if (@$Place['view'] === 'toc') {
+if (@$Page->place['view'] === 'toc') {
        printtoc($articles);
        return;
 }
 ob_start();
-shownews($articles, @$Place['n'] ?: 5);
-print getoutput();
+shownews($articles, @$Page->place['n'] ?: 5, !empty($Page->place['teaser']));
+$Page->raw = ob_get_clean();
+print $Page->render();