Temos pavadinimas: WordPress, Shopify ir PHPFusion programuotojų bendruomenė :: Reikia Pagalbos Del Naujienu

Parašė WantedBoy· 2012 Rugs. 13 10:09:21
#10

Nenaudoju php-fusion'o tai į kodą nežiūrėjau, bet dabar pagal SQL užklausą tūrėtų rodyti 5 naujiausias naujienas.


openside("Naujiausios");
 
$result = dbquery(
 
"SELECT tn.*, tc.*, user_id, user_name FROM ".$db_prefix."news tn
 
LEFT JOIN ".$db_prefix."users tu ON tn.news_name=tu.user_id
 
LEFT JOIN ".$db_prefix."news_cats tc ON tn.news_cat=tc.news_cat_id
 
WHERE ".groupaccess('news_visibility')." AND (news_start='0'||news_start<=".time().") AND (news_end='0'||news_end>=".time().")
 
ORDER BY news_date DESC LIMIT 0,5"
 
);
 
if (dbrows($result) != 0) {
 
while($data = dbarray($result)) {
 
$itemsubject = trimlink($data['news_subject'], 23);
 
 
 
            $wynik = dbquery("SELECT SUM(rating_vote) FROM ".DB_RATINGS." WHERE rating_type='N' AND rating_item_id='".$data['news_id']."'");
 
                $info2 = dbresult($wynik,0);
 
                $num_rating = dbcount("(rating_vote)", DB_RATINGS, "rating_type='N' AND rating_item_id='".$data['news_id']."'");
 
                $wyn_rating = ($num_rating ? $info2 / $num_rating : 0);
 
 
 
    $tas = $data['news_breaks'] == "y" ? nl2br(stripslashes($data['news_news'])) : stripslashes($data['news_news']);
 
 
 
 
 
   echo "<center><table cellpadding='0' cellspacing='0' width='150' class='borderis' onmouseover=\"className='borderis2'\" onmouseout=\"className='borderis'\">\n<tr>\n";
 
 
 
   echo"<td colspan='2' align='center'><a href='/news.php?readmore=".$data['news_id']."' tit='<table width=260px><tr><td class=c>
 
<b><span style=color:#0099FF;font-size:12px;>".$data['news_subject']."</span></b><br>$tas<br>
 
<b>&#381;i&#363;r&#279;jo: ".$data['news_reads']."</b>
 
 
 
</td></tr>
 
</table>'><img src='".IMAGES_N.$data['news_image']."' width='160' height='245' /></a></td>";
 
 
 
   echo"</tr>
 
   <td width='105' style='padding:2px;'><img src='".THEME."images/retitingai/".ceil($wyn_rating).".png' width='80' height='13' alt='".ceil($wyn_rating)."' style='vertical-align:middle;' title='".ceil($wyn_rating)."' /></td>
 
   <td class='c' align='right'><a href='/news.php?readmore=".$data['news_id']."'>&#381;i&#363;r&#279;ti</a></td>
 
   </tr></center>";
 
 
 
   echo"</table>";   
 
}
 
} else {
 
echo "<center>".$locale['004']."</center>\n";
 
}
 
closeside();