コード例 #1
0
ファイル: comments.php プロジェクト: josedigital/grumpycooker
        if (!$p->id) {
            continue;
        }
        $p = clone $p;
        $p->comment_title = htmlentities($comment->cite, ENT_QUOTES, "UTF-8") . " reply to: " . $p->title;
        $p->comment_body = htmlentities($comment->text, ENT_QUOTES, "UTF-8");
        $p->comment_date = $comment->created;
        $commentPages->add($p);
    }
    $rss = wire('modules')->get('MarkupRSS');
    $rss->title = wire('pages')->get('/')->headline . ' - ' . wire('page')->get('headline|title');
    $rss->itemTitleField = 'comment_title';
    $rss->itemDescriptionField = 'comment_body';
    $rss->itemDescriptionLength = 0;
    $rss->itemDateField = 'comment_date';
    $rss->render($commentPages);
}
/**********************************************************************************/
$limit = $page->quantity;
if ($input->urlSegment1) {
    // rss feed
    if ($input->urlSegment1 != 'rss') {
        throw new Wire404Exception();
    }
    renderCommentsRSS($limit);
} else {
    $start = ($input->pageNum - 1) * $limit;
    $headline = $page->get('headline|title');
    $content = $page->body . renderComments(findRecentComments($limit, $start), $limit);
    include "./main.inc";
}
コード例 #2
0
<?php

include_once "./blog.inc";
$url = $config->urls->root . 'comments/';
$out = "<h4>" . $page->title . "</h4>";
$comments = findRecentComments($page->quantity, 0, false);
if (count($comments)) {
    $out .= "<ul class='links'>";
    foreach ($comments as $comment) {
        $cite = htmlentities($comment->cite, ENT_QUOTES, "UTF-8");
        $date = formatDate($comment->created);
        $out .= "<li><span class='date'>{$date}</span><br />" . "<a href='{$comment->page->url}#comment{$comment->id}'>{$cite} &raquo; {$comment->page->title}</a>" . "</li>";
    }
    $out .= "</ul>";
    $out .= "<p>" . "<a class='more' href='{$url}'>" . __('More') . "</a>  " . "<a class='rss' href='{$url}rss/'>" . __('RSS') . "</a>" . "</p>";
} else {
    $out .= "<p>" . __('No comments yet') . "</p>";
}
echo $out;