Temos pavadinimas: WordPress, Shopify ir PHPFusion programuotojų bendruomenė :: Reikia pagalbos

Parašė And2s· 2009 Lie. 5 14:07:18
#4

openside("Top filmai");
$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)) {

echo "<table cellpadding='0' cellspadding='0' class='tbl-border'>";
echo "<tr>
<td class='tbl2'><b>Filmo pavadinimas</b></td>
<td class='tbl2' width='1%' align='center'><b>Įvertinimas</b></td>
</tr>";

$i = 0;
while ($data = dbarray($result)) {
$result = dbquery("SELECT * FROM ".DB_PREFIX."ratings WHERE rating_item_id='".$data['news_id']."' AND rating_type='N'");
if (dbrows($result) > 0) {
$rating = "<div style='background:url(http://img80.imageshack.us/img80/3918/ratingsbghp8.gif); height:21px; width:105px;'>".($data['count_votes'] > 0 ? str_repeat("<img src='http://img165.imageshack.us/img165/8202/starwd7.gif' alt='*' style='vertical-align:middle'>", ceil($data['sum_rating'] / $data['count_votes'])) : "")."</div>";
echo "<tr>
<td class='".($i%2?"tbl1":"tbl2")."'><a href='".BASEDIR."news.php?readmore=".$data['news_id']."'>".trimlink($data['news_subject'],25)."</a></td>
<td class='".($i%2?"tbl1":"tbl2")."'>$rating</td>";
$i++;
}
}

echo "</table>";
} else {
echo "<center>Naujienų Nėra</center>";
}
closeside();