最近有不少人www.55bbs.com那种首页分版是怎么实现的,其实实现方法很简单,只要简单对index.php做简单修改就可以实现,方法如下
打开index.php找到
- $sql = !empty($accessmasks)?
- "SELECT f.fid, f.fup, f.type, f.name, f.threads, f.posts, f.todayposts, f.lastpost, f.inheritedmod, ff.description, ff.moderators, ff.icon, ff.viewperm, a.allowview FROM {$tablepre}forums f
- LEFT JOIN {$tablepre}forumfields ff ON ff.fid=f.fid
- LEFT JOIN {$tablepre}access a ON a.uid='$discuz_uid' AND a.fid=f.fid
- WHERE f.status='1' ORDER BY f.type, f.displayorder"
- : "SELECT f.fid, f.fup, f.type, f.name, f.threads, f.posts, f.todayposts, f.lastpost, f.inheritedmod, ff.description, ff.moderators, ff.icon, ff.viewperm FROM {$tablepre}forums f
- LEFT JOIN {$tablepre}forumfields ff USING(fid)
- WHERE f.status='1' ORDER BY f.type, f.displayorder";
复制代码
改成
- $id='15,16,17,18';
- $sql = !empty($accessmasks)?
- "SELECT f.fid, f.fup, f.type, f.name, f.threads, f.posts, f.todayposts, f.lastpost, f.inheritedmod, ff.description, ff.moderators, ff.icon, ff.viewperm, a.allowview FROM {$tablepre}forums f
- LEFT JOIN {$tablepre}forumfields ff ON ff.fid=f.fid
- LEFT JOIN {$tablepre}access a ON a.uid='$discuz_uid' AND a.fid=f.fid
- WHERE f.status='1' AND f.fid IN ($id) ORDER BY f.type, f.displayorder"
- : "SELECT f.fid, f.fup, f.type, f.name, f.threads, f.posts, f.todayposts, f.lastpost, f.inheritedmod, ff.description, ff.moderators, ff.icon, ff.viewperm FROM {$tablepre}forums f
- LEFT JOIN {$tablepre}forumfields ff USING(fid)
- WHERE f.status='1' AND f.fid IN ($id) ORDER BY f.type, f.displayorder";
复制代码
其中
中的数字可以改成你要显示的板块的fid,这个数字你可以根据你的需要改变,数字之间用,隔开。
这些都做完后,把index.php另存为你需要的分区名称,例如sh.php然后用户访问sh.php就可以看到相应的分区了,如果想做成和www.55bbs.com一致的话,只要在模板里面添加相应的代码就可以了。
小技巧:如果你是最新的RCFINAL版本,相应的链接代码可以加在首页的广告代码中,很方便的实现首页分版的功能 |