Temos pavadinimas: WordPress, Shopify ir PHPFusion programuotojų bendruomenė :: Top naujienos, labiausiai komentuojamos, geriausiai ivertintos

Parašė minimukas· 2011 Kov. 22 13:03:52
#4

Gintuli stai padariau:

openside("Labiausiai vertinamos naujienos");
$result = dbquery("SELECT tn.*, SUM(tr.rating_vote) AS sum_rating, COUNT(tr.rating_item_id) AS count_votes FROM
".$db_prefix."news tn
LEFT JOIN ".$db_prefix."ratings tr ON tn.news_id=tr.rating_item_id AND tr.rating_type='N'
GROUP BY news_subject
ORDER BY SUM(tr.rating_vote) DESC LIMIT 10");
 
if (dbrows($result) != 0) {
while($data = dbarray($result)) {
$itemsubject = trimlink($data['news_subject'], 23);
echo "<img src='".THEME."images/bullet.gif' alt=''> <a href='".BASEDIR."news.php?readmore=".$data['news_id']."' title='".$data['news_subject']."' class='side'>$itemsubject</a><br>\n";
}
} else {
echo "<center>".$locale['004']."</center>\n";
}
closeside();



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();


Stai jau padariau tau abi paneles tikiosi +11 gaut :D