·设为首页收藏本站📧邮箱修改🎁免费下载专区💎积分购买✅卡密充值📒收藏夹🎖️众筹悬赏👽聊天室
返回列表 发布新帖

首页四格最新主题排序算法,如何修改为回复时间排序 New

123 0
发表于 2024-7-26 07:22:47 | 查看全部 阅读模式

马上注册,免费下载更多dz插件网资源。

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

×
算法在source/module/forum/forum_index.php
  1. $grids = array();if($_G['setting']['grid']['showgrid']) {        loadcache('grids');        $cachelife = $_G['setting']['grid']['cachelife'] ? $_G['setting']['grid']['cachelife'] : 600;        $now = dgmdate(TIMESTAMP, lang('forum/misc', 'y_m_d')).' '.lang('forum/misc', 'week_'.dgmdate(TIMESTAMP, 'w'));        if(TIMESTAMP - $_G['cache']['grids']['cachetime'] < $cachelife) {                $grids = $_G['cache']['grids'];        } else {                $images = array();                $_G['setting']['grid']['fids'] = in_array(0, $_G['setting']['grid']['fids']) ? 0 : $_G['setting']['grid']['fids'];                if($_G['setting']['grid']['gridtype']) {                        $grids['digest'] = C::t('forum_thread')->fetch_all_for_guide('digest', 0, array(), 3, 0, 0, 10, $_G['setting']['grid']['fids']);                } else {                        $images = C::t('forum_threadimage')->fetch_all_order_by_tid_for_guide(10, 0, $_G['setting']['grid']['fids']);                        foreach($images as $key => $value) {                                $tids[$value['tid']] = $value['tid'];                        }                        $grids['image'] = C::t('forum_thread')->fetch_all_by_tid($tids);                }                $grids['newthread'] = C::t('forum_thread')->fetch_all_for_guide('newthread', 0, array(), 0, 0, 0, 10, $_G['setting']['grid']['fids']);                $grids['newreply'] = C::t('forum_thread')->fetch_all_for_guide('reply', 0, array(), 0, 0, 0, 10, $_G['setting']['grid']['fids']);                $grids['hot'] = C::t('forum_thread')->fetch_all_for_guide('hot', 0, array(), 3, 0, 0, 10, $_G['setting']['grid']['fids']);                $_G['forum_colorarray'] = array('', '#EE1B2E', '#EE5023', '#996600', '#3C9D40', '#2897C5', '#2B65B7', '#8F2A90', '#EC1282');                foreach($grids as $type => $gridthreads) {                        foreach($gridthreads as $key => $gridthread) {                                $gridthread['dateline'] = str_replace('"', '\'', dgmdate($gridthread['dateline'], 'u', '9999', getglobal('setting/dateformat')));                                $gridthread['lastpost'] = str_replace('"', '\'', dgmdate($gridthread['lastpost'], 'u', '9999', getglobal('setting/dateformat')));                                if($gridthread['highlight'] && $_G['setting']['grid']['highlight']) {                                        $string = sprintf('%02d', $gridthread['highlight']);                                        $stylestr = sprintf('%03b', $string[0]);                                        $gridthread['highlight'] = ' style="';                                        $gridthread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';                                        $gridthread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';                                        $gridthread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';                                        $gridthread['highlight'] .= $string[1] ? 'color: '.$_G['forum_colorarray'][$string[1]] : '';                                        $gridthread['highlight'] .= '"';                                } else {                                        $gridthread['highlight'] = '';                                }                                if($_G['setting']['grid']['textleng']) {                                        $gridthread['oldsubject'] = dhtmlspecialchars($gridthread['subject']);                                        $gridthread['subject'] = cutstr($gridthread['subject'], $_G['setting']['grid']['textleng']);                                }                                $grids[$type][$key] = $gridthread;                        }                }                if(!$_G['setting']['grid']['gridtype']) {                        $grids['slide'] = $focuspic = $focusurl = $focustext = array();                        $grids['focus'] = 'config=5|0xffffff|0x0099ff|50|0xffffff|0x0099ff|0x000000';                        foreach($grids['image'] as $ithread) {                                if($ithread['displayorder'] < 0) {                                        continue;                                }                                if($images[$ithread['tid']]['remote']) {                                        $imageurl = $_G['setting']['ftp']['attachurl'].'forum/'.$images[$ithread['tid']]['attachment'];                                } else {                                        $imageurl = $_G['setting']['attachurl'].'forum/'.$images[$ithread['tid']]['attachment'];                                }                                $grids['slide'][$ithread['tid']] = array(                                                'image' => $imageurl,                                                'url' => 'forum.php?mod=viewthread&tid='.$ithread['tid'],                                                'subject' => addslashes($ithread['subject'])                                        );                        }                        $grids['slide'] = array_reverse($grids['slide'], true);                }                $grids['cachetime'] = TIMESTAMP;                savecache('grids', $grids);        }
复制代码
模板插入点

template/default/touch/forum/discuz.htm
  1.   </div>                <div id="tabs-box" class="swiper-container listbox cl">                        <div class="swiper-wrapper">                                <div class="swiper-slide">                                        <ul>                                        <!--{loop $grids['newthread'] $thread}-->                                        <!--{if !$thread['forumstick'] && $thread['closed'] > 1 && ($thread['isgroup'] == 1 || $thread['fid'] != $_G['fid'])}-->                                                <!--{eval $thread['tid']=$thread['closed'];}-->                                        <!--{/if}-->                                        <!--{eval $i++;}-->                                        <!--{eval $typeid = $tids_typeids[$thread['tid']];}-->                                        <li><a href="forum.php?mod=viewthread&tid=$thread['tid']"{if $thread['highlight']} $thread['highlight']{/if}><span class="mybk">[{$typeid_name[$typeid][name]}]</span><span class="mnum">$i</span>{$thread['oldsubject']}</a></li>                                        <!--{/loop}-->                                        </ul>                                </div>
复制代码


我知道答案 回答被采纳将会获得1 贡献 已有0人回答
我要说一句 收起回复

回复

 懒得打字嘛,点击右侧快捷回复【查看最新发布】   【应用商城享更多资源】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

图文热点
创宇盾启航版免费网站防御网站加速服务
投诉/建议联系

discuzaddons@vip.qq.com

未经授权禁止转载,复制和建立镜像,
如有违反,按照公告处理!!!
  • 联系QQ客服
  • 添加微信客服

联系DZ插件网微信客服|最近更新|Archiver|手机版|小黑屋|DZ插件网! ( 鄂ICP备20010621号-1 )|网站地图 知道创宇云防御

您的IP:18.188.231.93,GMT+8, 2024-9-8 08:12 , Processed in 0.203256 second(s), 76 queries , Gzip On, Redis On.

Powered by Discuz! X5.0 Licensed

© 2001-2024 Discuz! Team.

关灯 在本版发帖
扫一扫添加微信客服
QQ客服返回顶部
快速回复 返回顶部 返回列表