查看: 294|回复: 0

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

[复制链接]

170

主题

381

回帖

666

积分

高级会员

积分
666
发表于 2023-10-5 20:33:16 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

x
转存自原来的discuz官方论坛:

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

打开index.php找到:
  1. $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";
复制代码
改成:
  1. $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";
复制代码
其中的:
  1. $id='15,16,17,18';
复制代码
中的数字可以改成你要显示的板块的fid,这个数字你可以根据你的需要改变,数字之间用,隔开。

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

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

免责声明

1.本网站所收集的部分公开资料来源于互联网,转载的目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。
2.如果您发现网站上有侵犯您的知识产权的作品,请与我们取得联系,我们会及时修改或删除。

上一篇:给你论坛首页右侧加个倒计时,很好看
下一篇:cobob:用if代码 在不同板块调用不同的CSS定义(转存)

回复

使用道具 举报

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

本版积分规则

快速回复 返回顶部 返回列表