久久久久av_欧美日韩一区二区在线_国产精品三区四区_日韩中字在线

返回列表 發(fā)帖
查看: 709|回復(fù): 1

[求助] 首頁(yè)四格最新主題排序算法,如何修改為回復(fù)時(shí)間排序

63

主題

377

回帖

507

積分

自成一派

貢獻(xiàn)
6 點(diǎn)
金幣
5 個(gè)
樓主
發(fā)表于 2024-7-25 21:19:32 | 只看樓主 |倒序?yàn)g覽 |閱讀模式
算法在source/module/forum/forum_index.php

  1. $grids = array();
  2. if($_G['setting']['grid']['showgrid']) {
  3.         loadcache('grids');
  4.         $cachelife = $_G['setting']['grid']['cachelife'] ? $_G['setting']['grid']['cachelife'] : 600;
  5.         $now = dgmdate(TIMESTAMP, lang('forum/misc', 'y_m_d')).' '.lang('forum/misc', 'week_'.dgmdate(TIMESTAMP, 'w'));
  6.         if(TIMESTAMP - $_G['cache']['grids']['cachetime'] < $cachelife) {
  7.                 $grids = $_G['cache']['grids'];
  8.         } else {
  9.                 $images = array();
  10.                 $_G['setting']['grid']['fids'] = in_array(0, $_G['setting']['grid']['fids']) ? 0 : $_G['setting']['grid']['fids'];

  11.                 if($_G['setting']['grid']['gridtype']) {
  12.                         $grids['digest'] = C::t('forum_thread')->fetch_all_for_guide('digest', 0, array(), 3, 0, 0, 10, $_G['setting']['grid']['fids']);
  13.                 } else {
  14.                         $images = C::t('forum_threadimage')->fetch_all_order_by_tid_for_guide(10, 0, $_G['setting']['grid']['fids']);
  15.                         foreach($images as $key => $value) {
  16.                                 $tids[$value['tid']] = $value['tid'];
  17.                         }
  18.                         $grids['image'] = C::t('forum_thread')->fetch_all_by_tid($tids);
  19.                 }
  20.                 $grids['newthread'] = C::t('forum_thread')->fetch_all_for_guide('newthread', 0, array(), 0, 0, 0, 10, $_G['setting']['grid']['fids']);

  21.                 $grids['newreply'] = C::t('forum_thread')->fetch_all_for_guide('reply', 0, array(), 0, 0, 0, 10, $_G['setting']['grid']['fids']);
  22.                 $grids['hot'] = C::t('forum_thread')->fetch_all_for_guide('hot', 0, array(), 3, 0, 0, 10, $_G['setting']['grid']['fids']);

  23.                 $_G['forum_colorarray'] = array('', '#EE1B2E', '#EE5023', '#996600', '#3C9D40', '#2897C5', '#2B65B7', '#8F2A90', '#EC1282');
  24.                 foreach($grids as $type => $gridthreads) {
  25.                         foreach($gridthreads as $key => $gridthread) {
  26.                                 $gridthread['dateline'] = str_replace('"', '\'', dgmdate($gridthread['dateline'], 'u', '9999', getglobal('setting/dateformat')));
  27.                                 $gridthread['lastpost'] = str_replace('"', '\'', dgmdate($gridthread['lastpost'], 'u', '9999', getglobal('setting/dateformat')));
  28.                                 if($gridthread['highlight'] && $_G['setting']['grid']['highlight']) {
  29.                                         $string = sprintf('%02d', $gridthread['highlight']);
  30.                                         $stylestr = sprintf('%03b', $string[0]);

  31.                                         $gridthread['highlight'] = ' style="';
  32.                                         $gridthread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
  33.                                         $gridthread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
  34.                                         $gridthread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
  35.                                         $gridthread['highlight'] .= $string[1] ? 'color: '.$_G['forum_colorarray'][$string[1]] : '';
  36.                                         $gridthread['highlight'] .= '"';
  37.                                 } else {
  38.                                         $gridthread['highlight'] = '';
  39.                                 }
  40.                                 if($_G['setting']['grid']['textleng']) {
  41.                                         $gridthread['oldsubject'] = dhtmlspecialchars($gridthread['subject']);
  42.                                         $gridthread['subject'] = cutstr($gridthread['subject'], $_G['setting']['grid']['textleng']);
  43.                                 }

  44.                                 $grids[$type][$key] = $gridthread;
  45.                         }
  46.                 }
  47.                 if(!$_G['setting']['grid']['gridtype']) {

  48.                         $grids['slide'] = $focuspic = $focusurl = $focustext = array();
  49.                         $grids['focus'] = 'config=5|0xffffff|0x0099ff|50|0xffffff|0x0099ff|0x000000';
  50.                         foreach($grids['image'] as $ithread) {
  51.                                 if($ithread['displayorder'] < 0) {
  52.                                         continue;
  53.                                 }
  54.                                 if($images[$ithread['tid']]['remote']) {
  55.                                         $imageurl = $_G['setting']['ftp']['attachurl'].'forum/'.$images[$ithread['tid']]['attachment'];
  56.                                 } else {
  57.                                         $imageurl = $_G['setting']['attachurl'].'forum/'.$images[$ithread['tid']]['attachment'];
  58.                                 }
  59.                                 $grids['slide'][$ithread['tid']] = array(
  60.                                                 'image' => $imageurl,
  61.                                                 'url' => 'forum.php?mod=viewthread&tid='.$ithread['tid'],
  62.                                                 'subject' => addslashes($ithread['subject'])
  63.                                         );
  64.                         }
  65.                         $grids['slide'] = array_reverse($grids['slide'], true);
  66.                 }
  67.                 $grids['cachetime'] = TIMESTAMP;
  68.                 savecache('grids', $grids);
  69.         }
復(fù)制代碼
模板插入點(diǎn)

template/default/touch/forum/discuz.htm

  1.   </div>
  2.                 <div id="tabs-box" class="swiper-container listbox cl">
  3.                         <div class="swiper-wrapper">
  4.                                 <div class="swiper-slide">
  5.                                         <ul>
  6.                                         <!--{loop $grids['newthread'] $thread}-->
  7.                                         <!--{if !$thread['forumstick'] && $thread['closed'] > 1 && ($thread['isgroup'] == 1 || $thread['fid'] != $_G['fid'])}-->
  8.                                                 <!--{eval $thread['tid']=$thread['closed'];}-->
  9.                                         <!--{/if}-->
  10.                                         <!--{eval $i++;}-->
  11.                                         <!--{eval $typeid = $tids_typeids[$thread['tid']];}-->
  12.                                         <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>
  13.                                         <!--{/loop}-->
  14.                                         </ul>
  15.                                 </div>
復(fù)制代碼



我知道答案 回答被采納將會(huì)獲得1 貢獻(xiàn) 已有1人回答
回復(fù)

使用道具 舉報(bào)

19

主題

911

回帖

1036

積分

已臻大成

貢獻(xiàn)
12 點(diǎn)
金幣
15 個(gè)
QQ
沙發(fā)
發(fā)表于 2024-7-30 15:41:12 | 只看Ta
參照  導(dǎo)讀 頁(yè)面 “最新回復(fù)”
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

  • 關(guān)注公眾號(hào)
  • 有償服務(wù)微信
  • 有償服務(wù)QQ

手機(jī)版|小黑屋|Discuz! 官方交流社區(qū) ( 皖I(lǐng)CP備16010102號(hào) |皖公網(wǎng)安備34010302002376號(hào) )|網(wǎng)站地圖|star

GMT+8, 2025-7-2 02:03 , Processed in 0.046004 second(s), 11 queries , Redis On.

Powered by Discuz! W1.0 Licensed

Cpoyright © 2001-2025 Discuz! Team.

關(guān)燈 在本版發(fā)帖
有償服務(wù)QQ
有償服務(wù)微信
返回頂部
快速回復(fù) 返回頂部 返回列表