每周发帖之星广告位贡献值换广告位美丽的竹之舞广告置换办法
返回列表 回复 发帖

DZ5.5论坛首页四格代码详解

1. 上传附件到论坛的模板目录中的缺省模板目录

2. include/cache.func.php


查找
  1. 'medals'        => array('medals')
复制代码
上面加
  1. 'toplist'        => array('newthread', 'newreply', 'topdigest', 'topviews'),//TOPLIST_首页四格_全Cache版_域名交易论坛
复制代码
继续查找
  1. case 'medals':
  2.                         $table = 'medals';
  3.                         $cols = 'medalid, name, image';
  4.                         $conditions = "WHERE available='1'";
  5.                         break;
复制代码
上面加
  1. //首页四格TOPLIST_CACHE版,代码首
  2.                 case 'newthread':
  3.                         $table = 'threads t';
  4.                         $cols = 't.tid, t.fid, t.author, t.subject, t.dateline, t.lastpost, t.lastposter, t.views, t.replies, t.highlight, f.name';
  5.                         $conditions = "LEFT JOIN {$tablepre}forums f ON f.fid=t.fid WHERE t.displayorder!='-1' ORDER BY t.dateline DESC LIMIT 0, 10";
  6.                         break;

  7.                 case 'newreply':
  8.                         $table = 'threads t';
  9.                         $cols = 't.tid, t.fid, t.author, t.subject, t.dateline, t.lastpost, t.lastposter, t.views, t.replies, t.highlight, f.name';
  10.                         $conditions = "LEFT JOIN {$tablepre}forums f ON f.fid=t.fid WHERE t.replies>0 and t.displayorder!='-1'  ORDER BY t.lastpost DESC LIMIT 0, 10";
  11.                         break;
  12.                 case 'topdigest':
  13.                         $table = 'threads t';
  14.                         $cols = 't.tid, t.fid, t.author, t.subject, t.digest, t.dateline, t.lastpost, t.lastposter, t.views, t.replies, t.highlight, f.name';
  15.                         $conditions = "LEFT JOIN {$tablepre}forums f ON f.fid=t.fid WHERE digest>0 ORDER BY rand() LIMIT 0, 10";
  16.                         break;
  17.                
  18.                 case 'topviews':
  19.                         $table = 'threads t';
  20.                         $view = rand(1,3)==1 ? 'views' : 'replies';
  21.                         $cols = 't.tid, t.fid, t.author, t.subject, t.dateline, t.lastpost, t.lastposter, t.views, t.replies, t.highlight, f.name';
  22.                         $conditions = "LEFT JOIN {$tablepre}forums f ON f.fid=t.fid WHERE t.displayorder!='-1' ORDER BY t.$view DESC LIMIT 0, 10";
  23.                         break;

  24.                 //首页四格TOPLIST_CACHE版,  代码尾
复制代码
再找:
  1. case 'settings':
  2.                         $data['qihoo_links'] = array();
  3.                         while($setting = $db->fetch_array($query))
复制代码
上面加
  1. //首页四格TOPLIST_CACHE版,  代码首

  2.                 case 'newthread':
  3.                         $colorarray = array('', 'red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple', 'gray');
  4.                         while($topthread = $db->fetch_array($query)) {
  5.                                 $threadcolor = sprintf('%02d', $topthread['highlight']);
  6.                                 $topthread['author'] = $topthread['author'] ? $topthread['author'] : '游客';
  7.                                 $topthread['subjectc'] = cutstr($topthread['subject'], 28);
  8.                                 $topthread['threadcolor'] = $threadcolor[1] ? " style=\"color: ".$colorarray[$threadcolor[1]]."\"" : NULL;
  9.                                 $topthread['dateline'] = gmdate("Y-m-d H:i", $topthread['dateline'] + $timeoffset * 3600);
  10.                                 $topthread['lastpost'] = gmdate("Y-m-d H:i", $topthread['lastpost'] + $timeoffset * 3600);
  11.                                 $topthread['name'] =  AddSlashes(strip_tags(trim($topthread['name'])));
  12.                                 $data[] = $topthread;
  13.                         }
  14.                         break;

  15.                 case 'newreply':
  16.                         $colorarray = array('', 'red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple', 'gray');
  17.                         while($topthread = $db->fetch_array($query)) {
  18.                                 $threadcolor = sprintf('%02d', $topthread['highlight']);
  19.                                 $topthread['author'] = $topthread['author'] ? $topthread['author'] : '游客';
  20.                                 $topthread['subjectc'] = cutstr($topthread['subject'], 26);
  21.                                 $topthread['threadcolor'] = $threadcolor[1] ? " style=\"color: ".$colorarray[$threadcolor[1]]."\"" : NULL;
  22.                                 $topthread['dateline'] = gmdate("Y-m-d H:i", $topthread['dateline'] + $timeoffset * 3600);
  23.                                 $topthread['lastpost'] = gmdate("Y-m-d H:i", $topthread['lastpost'] + $timeoffset * 3600);
  24.                                 $topthread['name'] =  AddSlashes(strip_tags(trim($topthread['name'])));
  25.                                 $data[] = $topthread;
  26.                         }
  27.                         break;

  28.                 case 'topdigest':
  29.                         $colorarray = array('', 'red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple', 'gray');
  30.                         while($topthread = $db->fetch_array($query)) {
  31.                                 $threadcolor = sprintf('%02d', $topthread['highlight']);
  32.                                 $digest = array('1'=>'[Ⅰ]','2'=>'[Ⅱ]','3'=>'[Ⅲ]');
  33.                                 $topthread['subjectc'] = $digest[$topthread['digest']]."-".cutstr($topthread['subject'], 23);
  34.                                 $topthread['author'] = $topthread['author'] ? $topthread['author'] : '游客';
  35.                                 $topthread['threadcolor'] = $threadcolor[1] ? " style=\"color: ".$colorarray[$threadcolor[1]]."\"" : NULL;
  36.                                 $topthread['dateline'] = gmdate("Y-m-d H:i", $topthread['dateline'] + $timeoffset * 3600);
  37.                                 $topthread['lastpost'] = gmdate("Y-m-d H:i", $topthread['lastpost'] + $timeoffset * 3600);
  38.                                 $topthread['name'] =  AddSlashes(strip_tags(trim($topthread['name'])));
  39.                                 $data[] = $topthread;
  40.                         }
  41.                         break;

  42.                 case 'topviews':
  43.                         $colorarray = array('', 'red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple', 'gray');
  44.                         while($topthread = $db->fetch_array($query)) {
  45.                                 $threadcolor = sprintf('%02d', $topthread['highlight']);
  46.                                 $topthread['subjectc'] = cutstr($topthread['subject'], 32);
  47.                                 $topthread['threadcolor'] = $threadcolor[1] ? " style=\"color: ".$colorarray[$threadcolor[1]]."\"" : NULL;
  48.                                 $topthread['author'] = $topthread['author'] ? $topthread['author'] : '游客';
  49.                                 $topthread['dateline'] = gmdate("Y-m-d H:i", $topthread['dateline'] + $timeoffset * 3600);
  50.                                 $topthread['lastpost'] = gmdate("Y-m-d H:i", $topthread['lastpost'] + $timeoffset * 3600);
  51.                                 $topthread['name'] =  AddSlashes(strip_tags(trim($topthread['name'])));
  52.                                 $data[] = $topthread;
  53.                         }
  54.                         break;


  55.                 //首页四格TOPLIST_CACHE版,   代码尾
复制代码
3. include/newthread.inc.php

查找
  1. updatepostcredits('+', $discuz_uid, $postcredits);
复制代码
下面加
  1. require_once DISCUZ_ROOT.'./include/cache.func.php';
  2.                 updatecache('newthread');
复制代码
4. include/newreply.inc.php

查找
  1. updatepostcredits('+', $discuz_uid, $replycredits);
复制代码
下面加
  1. require_once DISCUZ_ROOT.'./include/cache.func.php';
  2.                 updatecache('newthread');
复制代码
5. include/editpost.inc.php

查找
  1. updatepostcredits('-', $orig['authorid'], ($isfirstpost ? $postcredits : $replycredits));
复制代码
下面加
  1. require_once DISCUZ_ROOT.'./include/cache.func.php';
  2.                 updatecache('newthread');
复制代码
第6步:论坛根目录 index.php
查找
DZ 5.5
  1. $threads = $posts = $todayposts = $fids = $announcepm = 0;
复制代码
下面加
  1. //首页四格TOPLIST_CACHE版,   代码首
  2.         if(!isset($_COOKIE['discuz_collapse']) || strpos($_COOKIE['discuz_collapse'], 'category_hk2 ') === FALSE) {
  3.                 $categorys_hk2 = 'collapsed_no.gif';
  4.                 $collapse['category_hk2'] = '';
  5.         } else {
  6.                 $categorys_hk2 = 'collapsed_yes.gif';
  7.                 $collapse['category_hk2'] = 'display: none';
  8.         }
  9.         
  10.         if($categorys_hk2 == 'collapsed_no.gif'){
  11.         require_once DISCUZ_ROOT.'./forumdata/cache/cache_toplist.php';
  12.         $toplistloop = $_DCACHE['newthread'];
  13.         }
  14.         //首页四格TOPLIST_CACHE版,   代码尾
复制代码
7. 根目录 topicadmin.php

查找
  1. showmessage((isset($resultarray['message']) ? $resultarray['message'] : 'admin_succeed'),
复制代码
上面加
  1. require_once DISCUZ_ROOT.'./include/cache.func.php';
  2.         updatecache('newthread');
复制代码
第8步: templates\default\discuz.htm

查找
DZ5.5
  1. <!--{if !empty($newpmexists) || $announcepm}-->
  2.         <div style="clear: both; margin-top: 5px" id="pmprompt">
  3.         {template pmprompt}
  4.         </div>
  5. <!--{/if}-->
复制代码
下面加
  1. <div style="clear: both; margin-top: 5px;">
  2. <div class="spaceborder" style="width: 98%">
  3.         {template toplist}
  4.         </div></div>
复制代码
上传 附件里的 TOPLIST.htm到模版风格目录

千万记得更新缓存 !!

[ 本帖最后由 58717441 于 2007-4-21 14:22 编辑 ]
查看全部内容:请登录或者注册
附件: 您所在的用户组无法下载或查看附件
一直在找DZ5.5的首页四格,这个很不错的谢谢楼主分享

hehe

不知道能不能~
返回列表