コード例 #1
0
ファイル: template.php プロジェクト: benthebear/Mies
/**
 * Returns a formatted list of recent comments to be displayed in the comment block.
 *
 * @return
 *   The comment list HTML.
 * @ingroup themeable
 */
function mies_comment_block()
{
    $items = array();
    $output = "<table>";
    foreach (comment_get_recent(15) as $comment) {
        //print_r($comment);
        $fullComment = _comment_load($comment->cid);
        //print_r($fullComment);
        if ($fullComment->uid != "0") {
            $user = user_load($fullComment->uid);
            $username = $user->name;
        } else {
            $username = $fullComment->name;
        }
        $output .= "<tr>";
        $output .= "<td class='first-row'>";
        $output .= $username;
        $output .= "</td>";
        $output .= "<td class='second-row'>";
        $output .= l($comment->subject, 'node/' . $comment->nid, array('fragment' => 'comment-' . $comment->cid));
        $output .= "</td>";
        $output .= "<td class='third-row'>";
        //$output .= format_date($comment->timestamp, "large");
        $output .= "</td>";
        $output .= "</tr>";
    }
    $output .= "</table>";
    return $output;
}
コード例 #2
0
ファイル: misc.php プロジェクト: rolfvandekrol/neb
function neb_comment_block()
{
    $items = array();
    $number = variable_get('comment_block_count', 10);
    foreach (comment_get_recent($number) as $comment) {
        //kpr($comment->changed);
        //print date('Y-m-d H:i', $comment->changed);
        $items[] = '<h3>' . l($comment->subject, 'comment/' . $comment->cid, array('fragment' => 'comment-' . $comment->cid)) . '</h3>' . ' <time datetime="' . date('Y-m-d H:i', $comment->changed) . '">' . t('@time ago', array('@time' => format_interval(REQUEST_TIME - $comment->changed))) . '</time>';
    }
    if ($items) {
        return theme('item_list', array('items' => $items, 'daddy' => 'comments'));
    } else {
        return t('No comments available.');
    }
}
コード例 #3
0
<?php

$items = array();
$number = variable_get('comment_block_count', 10);
foreach (comment_get_recent($number) as $comment) {
    $items[] = l($comment->subject, 'comment/' . $comment->cid, array('fragment' => 'comment-' . $comment->cid)) . '&nbsp;<span>' . t('(@time)', array('@time' => format_date($comment->changed))) . '</span>';
}
if ($items) {
    print theme('item_list', array('items' => $items));
} else {
    print t('No comments available.');
}