Temos pavadinimas: WordPress, Shopify ir PHPFusion programuotojų bendruomenė :: Top naujienos, labiausiai komentuojamos, geriausiai ivertintos
Parašė gintulis· 2011 Kov. 21 22:03:40
#1
Sveiki man reikia padaryt į 4 varijantus. Naujausios naujienos, daugiausiai skaitytos naujienos, labiausiai komentuojamos naujienos ir geriausiai ivertintos naujienos
Gal galėtumėt pasakyt kaip turėtu atroditi štai šie 4 varijantai
ORDER BY news_reads (Daugiausiai skaitytos naujienos)
ORDER BY news_datestamp (Naujausios naujienos)
Reikia dar dviejų :)
Parašė minimukas· 2011 Kov. 21 23:03:44
#2
ORDER BY SUM(tr.rating_vote) (labiausiai vertinamos naujienos)
Parašė gintulis· 2011 Kov. 21 23:03:00
#3
minimukas - gaunu erorą kai šitą idedu
Parašė minimukas· 2011 Kov. 22 00:03:59
#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
Redagavo minimukas· 2011 Kov. 22 13:03:40
Parašė minimukas· 2011 Kov. 22 13:03:52
#5
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
Parašė gintulis· 2011 Kov. 22 13:03:26
#6
minimukas + 11 parėjo :D
Parašė minimukas· 2011 Kov. 22 13:03:57
#7
Nerodo kad butu, bet ligu jau buvai seniau uzdejes :D na tai kaip veikia jie tau??:)
Parašė gintulis· 2011 Kov. 22 13:03:01
#8
Jo tik jei dar gali tam kur labiausiai komentuojamos nuimk kad neroditu skaičiaus kiek komentarų ir dar šitą pridėt $itemsubject = trimlink($data['news_subject'], 34); kad susitrumpintu pavadinimas :)
Parašė minimukas· 2011 Kov. 22 14:03:37
#9
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'], 34)."</a></td>\n";
}
echo "</table>";
} else {
echo "<center>".$locale['004']."</center>\n";
}
closeside();
Parašė gintulis· 2011 Kov. 22 14:03:04
#10
minimukas - dėkui tau labai :)