给主题列表页增加随机排序,刷屏即可浏览不一样已沉下去的内容 New
上一个分享主要是在DIY模块添加随机,其实前面操作是在PC端主题列表页增加随机排序,才随之有群组,手机端的同步。同理,下面是电脑端主题列表页,随机排序的记录帖子,复制过来,给你。
更改系统文件,添加随机排序的核心逻辑,当URL参数random=1时使用RAND()函数进行排序。
文件路径:source\app\forum\child\forumdisplay\threadlist.php
大约15行,if($filter !== 'hot') {
$threadlist = [];
$indexadd = '';
在下面开始添加:
javascript
▼ 展开
当然,模板文件也要添加了前端界面元素,包括工具栏的随机排序按钮和排序下拉菜单中的随机排序选项,文件路径:当前模板/forum\forumdisplay_list.php
1,在排序方式显示文本中,约17行添加:
javascript
▼ 展开
2,在工具栏添加随机排序按钮(约24行)
javascript
▼ 展开
3,在filter_kmpx_menu排序下拉菜单中添加选项(约76行):
javascript
▼ 展开
4,在filter_orderby_menu排序菜单中添加选项(约98行):
javascript
▼ 展开 使用了mysql的RAND()语句,数据稍多的时候就将变成性能灾难,请站长们谨慎使用
存在较严重问题,不适合作为教程,移动到杂谈版块了 厉害,可以出个x5的圈子添加地区的教程不,用dz自带的地区数据,
.ce-block { margin-bottom: 20px;}.ce-block__content,.ce-toolbar__content { /* max-width:calc(100% - 50px) */ margin-left: auto; margin-right: auto;}.ce-paragraph { line-height: 1.6em; outline: none; text-indent: 2em; font-size: 16px;}.ce-paragraph--right { text-align: right;}.ce-paragraph--center { text-align: center;}.ce-paragraph--left { text-align: left;}.ce-paragraph--justify { text-align: justify;}.ce-paragraph-text-indent { text-align: justify;}.ce-paragraph:empty::before{content: attr(data-placeholder);color: #707684;font-weight: normal;opacity: 0;}/** Show placeholder at the first paragraph if Editor is empty */.codex-editor--empty .ce-block:first-child .ce-paragraph:empty::before {opacity: 1;}.codex-editor--toolbox-opened .ce-block:first-child .ce-paragraph:empty::before,.codex-editor--empty .ce-block:first-child .ce-paragraph:empty:focus::before {opacity: 0;}.ce-paragraph p:first-of-type{ margin-top: 0;}.ce-paragraph p:last-of-type{ margin-bottom: 0;}.svg-icon { width: 1em; height: 1em;}.svg-icon path,.svg-icon polygon,.svg-icon rect { fill: #4691f6;}.svg-icon circle { stroke: #4691f6; stroke-width: 1;}.inline-code {background: rgba(250, 239, 240, 0.78);color: #b44437;padding: 3px 4px;border-radius: 5px;margin: 0 1px;font-family: inherit;font-size: 0.86em;font-weight: 500;letter-spacing: 0.3px;} 后台 不是有地区吗,我是3.5升级上来的,本来就自带的有。x5好象没有地区,得自己添加,看着我也是头大,这么多地区一个一个添加 TaC 发表于 2026-4-17 10:53
后台 不是有地区吗,我是3.5升级上来的,本来就自带的有。x5好象没有地区,得自己添加,看着我也是头大, ... 是给圈子增加一个地区功能,
.ce-block { margin-bottom: 20px;}.ce-block__content,.ce-toolbar__content { /* max-width:calc(100% - 50px) */ margin-left: auto; margin-right: auto;}.ce-paragraph { line-height: 1.6em; outline: none; text-indent: 2em; font-size: 16px;}.ce-paragraph--right { text-align: right;}.ce-paragraph--center { text-align: center;}.ce-paragraph--left { text-align: left;}.ce-paragraph--justify { text-align: justify;}.ce-paragraph-text-indent { text-align: justify;}.ce-paragraph:empty::before{content: attr(data-placeholder);color: #707684;font-weight: normal;opacity: 0;}/** Show placeholder at the first paragraph if Editor is empty */.codex-editor--empty .ce-block:first-child .ce-paragraph:empty::before {opacity: 1;}.codex-editor--toolbox-opened .ce-block:first-child .ce-paragraph:empty::before,.codex-editor--empty .ce-block:first-child .ce-paragraph:empty:focus::before {opacity: 0;}.ce-paragraph p:first-of-type{ margin-top: 0;}.ce-paragraph p:last-of-type{ margin-bottom: 0;}.svg-icon { width: 1em; height: 1em;}.svg-icon path,.svg-icon polygon,.svg-icon rect { fill: #4691f6;}.svg-icon circle { stroke: #4691f6; stroke-width: 1;}.inline-code {background: rgba(250, 239, 240, 0.78);color: #b44437;padding: 3px 4px;border-radius: 5px;margin: 0 1px;font-family: inherit;font-size: 0.86em;font-weight: 500;letter-spacing: 0.3px;} 没搞过,不过你可以在分类里设置地区呀 分类只能设置两级分类,要是能增加4级子分类就好了,不知道哪个容易实现点 非常影响数据库性能的一句SQL
页:
[1]