Список 10 последних комментариев

<?php
$max
= 10; // количество комментариев
$query = 'SELECT nid,cid,subject FROM {comments} order by timestamp desc ';
$result = db_query_range($query, 0, $max);
$items = array ();
while (
$comment = db_fetch_object($result)) {
   
$items[] = l($comment->subject, "node/$comment->nid", NULL, NULL, "comment-$comment->cid");
}
if (
count($items)) {
    return
theme('item_list', $items);
}
?>

Метки: