/** * 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; }
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.'); } }
<?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)) . ' <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.'); }