On this page
function theme_comment_block
theme_comment_block()
Returns HTML for a list of recent comments to be displayed in the comment block.
Related topics
File
- modules/comment/comment.module, line 597
- Enables users to comment on published content.
Code
function theme_comment_block() {
$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 ago', array('@time' => format_interval(REQUEST_TIME - $comment->changed))) . '</span>';
}
if ($items) {
return theme('item_list', array('items' => $items));
}
else {
return t('No comments available.');
}
}
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!comment!comment.module/function/theme_comment_block/7.x