openside("labiausiai komentuojamos naujienos");
$result = dbquery("
SELECT comment_item_id, comment_id, comment_message, COUNT(comment_item_id) FROM ".DB_COMMENTS."
WHERE comment_type='N' GROUP BY comment_item_id ORDER BY COUNT(comment_item_id) DESC LIMIT 10");
if(dbrows($result)!=0) {
echo "<table width='100%' cellpadding='0' cellspacing='0'>";
while($data = dbarray($result)) {
$result2 = dbquery("SELECT * FROM ".DB_NEWS." WHERE news_id='".$data['comment_item_id']."'");
$data2 = dbarray($result2);
$num = dbcount("(comment_id)", DB_COMMENTS, "comment_item_id='".$data['comment_item_id']."' AND comment_type='N'");
echo "<tr>\n<td class='small' align='left'>".THEME_BULLET." <a href='".BASEDIR."news.php?readmore=".$data['comment_item_id']."' title='".$data2['news_subject']."' class='side'> ";
echo trimlink($data2['news_subject'], $data)."</a></td>\n<td class='small' align='right'>".$num."</td>\n</tr>\n";
}
echo "</table>";
} else {
echo "<center>".$locale['004']."</center>\n";
}
closeside();