===============================================
插件演示: 牡丹园外-吉林大学校友联谊会
插件版本: Discuz! 5.5.0 GBK 简体中文正式版
插件质量: 首发beta测试版
安装难易: 易
数据库表: 无
修改文件: index.php,discuz.htm, css.htm
增加文件: toplist.htm images/default/toplist
插件作者: mousecat
发布理由: 很多人要,自己也很喜欢
================================================
文件修改:
1。修改index.php
查找:
- require_once DISCUZ_ROOT.'./include/forum.func.php';
复制代码
下面添加:
- require_once DISCUZ_ROOT.'./include/misc.func.php';
复制代码
继续找:
- $newthreads = round(($timestamp - $lastvisit + 600) / 1000) * 1000;
复制代码
下面添加:
- $colorarray = array('', 'red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple', 'gray');
- //最新话题 toplist by mousecat starts//
- $hack_cut_str =28; //修改标题显示字数
- $hack_cut_strauthor = 9;
- $new_post_threadlist = array();
- $nthread = array();
- $query = $db->query("SELECT t.*, f.name FROM {$tablepre}threads t, {$tablepre}forums f WHERE t.fid<>'$fid' AND f.fid=t.fid ORDER BY t.dateline DESC LIMIT 0, 8");
- while($nthread = $db->fetch_array($query)) {
- $nthread['forumname'] = $nthread['name'];
- $nthread['view_subject'] = cutstr($nthread['subject'],$hack_cut_str);
- $nthread['view_author'] = cutstr($nthread['author'],$hack_cut_strauthor);
- $nthread['date']= gmdate("$dateformat $timeformat", $nthread['dateline'] + $timeoffset * 3600);
- $nthread['lastreplytime']= gmdate("$dateformat $timeformat", $nthread[lastpost] + ($timeoffset * 3600));
- if($nthread['highlight']) {
- $string = sprintf('%02d', $nthread['highlight']);
- $stylestr = sprintf('%03b', $string[0]);
- $nthread['highlight'] = 'style="';
- $nthread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
- $nthread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
- $nthread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
- $nthread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
- $nthread['highlight'] .= '"';
- } else {
- $nthread['highlight'] = '';
- }
- $new_post_threadlist[] = $nthread;
- }
- //最新话题 toplist by mousecat ends//
- //最新回复 toplist by mousecat starts//
- $hack_cut_str = 28; //修改标题显示字数
- $hack_cut_strauthor = 9;
- $new_reply_threadlist = array();
- $rthread = array();
- $query = $db->query("SELECT t.*, f.name FROM {$tablepre}threads t, {$tablepre}forums f WHERE t.fid<>'$fid' AND f.fid=t.fid AND t.closed NOT LIKE 'moved|%' AND t.replies !=0 ORDER BY t.lastpost DESC LIMIT 0, 8");
- while($rthread = $db->fetch_array($query)) {
- $rthread['forumname'] = $rthread['name'];
- $rthread['view_subject'] = cutstr($rthread['subject'],$hack_cut_str);
- $rthread['view_lastposter'] = cutstr($rthread['lastposter'],$hack_cut_strauthor);
- $rthread['date']= gmdate("$dateformat $timeformat", $rthread['dateline'] + $timeoffset * 3600);
- $rthread['lastreplytime']= gmdate("$dateformat $timeformat", $rthread[lastpost] + ($timeoffset * 3600));
- if($rthread['highlight']) {
- $string = sprintf('%02d', $rthread['highlight']);
- $stylestr = sprintf('%03b', $string[0]);
- $rthread['highlight'] = 'style="';
- $rthread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
- $rthread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
- $rthread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
- $rthread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
- $rthread['highlight'] .= '"';
- } else {
- $rthread['highlight'] = '';
- }
- $new_reply_threadlist[] = $rthread;
- }
- //最新回复 toplist by mousecat ends//
复制代码
2. 打开/templates/default/discuz.htm
查找:
- <!--{if !empty($newpmexists) || $announcepm}-->
- <div style="clear: both; margin-top: 5px" id="pmprompt">
- {template pmprompt}
- </div>
- <!--{/if}-->
复制代码
在下面添加:
- <!--{if empty($gid)}-->
- {template toplist}
- <!--{/if}-->
复制代码
3. 打开/templates/default/css.htm
在最后面添加:
- /*TopList starts*/
- .toplist {
- width: 98%; min-width: 770px;
- clear: both;
- padding: 4px;
- border-top: 1px solid #E0E0E0;
- border-left: 1px solid #E0E0E0;
- border-right: 3px solid #E0E0E0;
- border-bottom: 3px solid #E0E0E0;
- background-color: #FFF;
- background-repeat: repeat-x;
- margin-bottom: 10px;
- font-size: 12px;
- }
- .toplist2 {border-top: #CC3399 5px solid; clear: both; overflow: hidden}
- .toplist2 div {float: right; text-align: center}
- .lbox {margin: 3px; padding: 3px; text-align: left}
- .toplistpost{
- border-bottom: #DDDDDD 1px dashed;
- padding: 4px 0 0 8px;
- display: block;
- overflow: hidden;
- height: 19px;
- text-align: left;
- }
- /*TopList ends*/
复制代码
4. 上传附件中的文件到相应的文件夹
5。后台更新缓存
结束!
[ 本帖最后由 mousecat 于 2007-3-28 13:20 编辑 ] |