返回列表 发帖
查看: 731|回复: 1

童虎:论坛首页分版最简单实现方法(转存)

3

主题

52

回帖

62

积分

渐入佳境

贡献
0 点
金币
5 个
QQ
发表于 2023-10-5 12:50:29 | 显示全部楼层 |阅读模式
转存自原来的discuz官方论坛:

最近有不少人www.55bbs.com那种首页分版是怎么实现的,其实实现方法很简单,只要简单对index.php做简单修改就可以实现,方法如下

打开index.php找到:


  1. $sql = !empty($accessmasks)?
  2.            "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
  3.             LEFT JOIN {$tablepre}forumfields ff ON ff.fid=f.fid
  4.             LEFT JOIN {$tablepre}access a ON a.uid='$discuz_uid' AND a.fid=f.fid
  5.             WHERE f.status='1' ORDER BY f.type, f.displayorder"
  6.          : "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
  7.             LEFT JOIN {$tablepre}forumfields ff USING(fid)
  8.             WHERE f.status='1' ORDER BY f.type, f.displayorder";
复制代码
改成:

  1. $id='15,16,17,18';

  2. $sql = !empty($accessmasks)?
  3.          "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
  4.           LEFT JOIN {$tablepre}forumfields ff ON ff.fid=f.fid
  5.           LEFT JOIN {$tablepre}access a ON a.uid='$discuz_uid' AND a.fid=f.fid
  6.           WHERE f.status='1' AND f.fid IN ($id) ORDER BY f.type, f.displayorder"
  7.          : "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
  8.           LEFT JOIN {$tablepre}forumfields ff USING(fid)
  9.           WHERE f.status='1' AND f.fid IN ($id) ORDER BY f.type, f.displayorder";
复制代码
其中的:

  1. $id='15,16,17,18';
复制代码
中的数字可以改成你要显示的板块的fid,这个数字你可以根据你的需要改变,数字之间用,隔开。

这些都做完后,把index.php另存为你需要的分区名称,例如sh.php然后用户访问sh.php就可以看到相应的分区了,如果想做成和www.55bbs.com一致的话,只要在模板里面添加相应的代码就可以了。

小技巧:如果你是最新的RCFINAL版本,相应的链接代码可以加在首页的广告代码中,很方便的实现首页分版的功能。

老站长
回复

使用道具 举报

5

主题

82

回帖

96

积分

渐入佳境

贡献
0 点
金币
7 个
发表于 2024-1-26 21:22:04 | 显示全部楼层
学习!!!!!!!!!!!!!!!!!!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 关注公众号
  • 有偿服务微信
  • 有偿服务QQ

手机版|小黑屋|Discuz! 官方交流社区 ( 皖ICP备16010102号 |皖公网安备34010302002376号 )|网站地图|star

GMT+8, 2024-5-3 00:04 , Processed in 0.034144 second(s), 7 queries , Redis On.

Powered by Discuz! W1.0 Licensed

Cpoyright © 2001-2024 Discuz! Team.

关灯 在本版发帖
有偿服务QQ
有偿服务微信
返回顶部
快速回复 返回顶部 返回列表