nieuws: widget option for teaser preference
[minimedit.git] / widget / nieuws.php
index 73258b2a31c53024f2693d0b5d7cc1cb5531b77b..49f0453f39d2a835c9e81eded2bad5c2b50f7d8c 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";
@@ -19,7 +19,7 @@ function shownews($input, $limit = 1000)
                        '<h3><a href="/%s">%s <small class="date">%s</small></a></h3>',
                        $article->link, $article->title, showdate($article->dateparts)
                );
-               print $article->story;
+               print $abbr ? "<p>{$article->teaser}</p>\n" : $article->story;
                print '</div>';
                print "</article>\n\n";
 
@@ -44,7 +44,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";
@@ -73,6 +73,6 @@ if (@$Page->place['view'] === 'toc') {
        return;
 }
 ob_start();
-shownews($articles, @$Page->place['n'] ?: 5);
+shownews($articles, @$Page->place['n'] ?: 5, !empty($Page->place['teaser']));
 $Page->raw = ob_get_clean();
 print $Page->render();