<?
require("global.php");
$foruminfo=$DB_site->query("SELECT forumid, title FROM forum ORDER BY categoryid,displayorder");
while ($forum=$DB_site->fetch_array($foruminfo)) {
echo ("<a href=\"forumdisplay.php?forumid=".$forum[forumid]."\">".$forum[title]."</a><br>");
$threadinfo=$DB_site->query_first("SELECT threadid,title,replycount,views FROM thread WHERE forumid=$forum[forumid] and dateline > UNIX_TIMESTAMP(curdate()-30) ORDER BY views DESC LIMIT 1");
echo (" <a href=\"showthread.php?threadid=".$threadinfo[threadid]."\">".htmlspecialchars($threadinfo[title])."</a> [views: ".$threadinfo[views]."] [replies: ".$threadinfo[replycount]."]<br>");
}
?>
The forums should already be listed in the order they are displayed in forumhome. It orders them by categoryid and then by displayorder to get the same sequence.
Here is the code where you can change the number of threads shown. Just change the LIMIT on the second Query to modify the amount.
Code:
<?
require("global.php");
$foruminfo=$DB_site->query("SELECT forumid, title FROM forum ORDER BY categoryid,displayorder");
while ($forum=$DB_site->fetch_array($foruminfo)) {
echo ("<a href=\"forumdisplay.php?forumid=".$forum[forumid]."\">".$forum[title]."</a><br>");
$threadinfo=$DB_site->query("SELECT threadid,title,replycount,views FROM thread WHERE forumid=$forum[forumid] AND dateline > UNIX_TIMESTAMP(curdate()-30) ORDER BY views DESC LIMIT 5");
while ($thread=$DB_site->fetch_array($threadinfo)) {
echo (" <a href=\"showthread.php?threadid=".$thread[threadid]."\">".htmlspecialchars($thread[title])."</a> [views: ".$thread[views]."] [replies: ".$thread[replycount]."]<br>");
}
}
?>
There seems to be a problem with your global.php file...
Warning: Cannot add header information - headers already sent by (output started at /home/animeboa/public_html/forums/mostviewed.php:7) in /home/animeboa/public_html/forums/global.php on line 756
Warning: Cannot add header information - headers already sent by (output started at /home/animeboa/public_html/forums/mostviewed.php:7) in /home/animeboa/public_html/forums/global.php on line 763
Originally posted by wluke There seems to be a problem with your global.php file...
Warning: Cannot add header information - headers already sent by (output started at /home/animeboa/public_html/forums/mostviewed.php:7) in /home/animeboa/public_html/forums/global.php on line 756
Warning: Cannot add header information - headers already sent by (output started at /home/animeboa/public_html/forums/mostviewed.php:7) in /home/animeboa/public_html/forums/global.php on line 763
thanks.. i had some server problems and was playing around with the formatting.. it should work now
Originally posted by wluke If you want to exclude certain forums. i.e. moderator forums, then add a WHERE clause to $foruminfo... For example:
WHERE forumid<>1