CODE:
$hack_forumid = "4,6,7,10,12,13,15,18,19,20,21,24,26,27,31,32,33,34,35";//要显示的论坛的fid.
2、找到:
CODE:
$query = $db->query("SELECT t.*, f.name FROM {$tablepre}threads t, {$tablepre}forums f WHERE t.fid<>'$fid' AND f.fid=t.fid AND t.closed NOT LIKE 'moved|%' AND t.replies !=0 ORDER BY t.lastpost DESC LIMIT 0, 10");
将其替换为:
CODE:
//修改SQL语句,增加栏目过滤条件AND f.fid=$hack_forumid//
$query = $db->query("SELECT t.*, f.name FROM {$tablepre}threads t, {$tablepre}forums f WHERE t.fid<>'$fid' AND f.fid=t.fid
AND t.closed NOT LIKE 'moved|%' AND t.replies !=0 AND f.fid in($hack_forumid) ORDER BY t.lastpost DESC LIMIT 0, 10");
==================================
回应2楼的帖, 因為版的ID太多, 也許可以改成:
$hack_forumid = "1,2,3";//不要显示的论坛的fid.
//修改SQL语句,增加栏目过滤条件AND f.fid=$hack_forumid//
$query = $db->query("SELECT t.*, f.name FROM {$tablepre}threads t, {$tablepre}forums f WHERE t.fid<>'$fid' AND f.fid=t.fid
AND t.closed NOT LIKE 'moved|%' AND t.replies !=0 AND f.fid NOT IN($hack_forumid) ORDER BY t.lastpost DESC LIMIT 0, 10");
僅供參考. 也謝謝LZ. 的確是可以用. |