前一个版本我自己加了个随机贴推荐,但现在怎末使用自定义模块添加呢?
这是随机的搜贴代码- //随机
- $hack_cut_str = 48; //标题字数
- $hack_cut_strauthor = 9;
- $mthread = 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 AND f.fid not in (0) AND t.displayorder not in (-1,-2) ORDER BY rand() DESC LIMIT 0, 10");
- while($mthread = $db->fetch_array($query)) {
- $mthread['forumname'] = ereg_replace('<[^>]*>','',$mthread['name']);
- $mthread['view_subject'] = cutstr($mthread['subject'],$hack_cut_str);
- $mthread['view_lastposter'] = cutstr($mthread['lastposter'],$hack_cut_strauthor);
- $mthread['date']= gmdate("$dateformat $timeformat", $mthread['dateline'] + $timeoffset * 3600);
- $mthread['lastreplytime']= gmdate("$dateformat $timeformat", $mthread[lastpost] + ($timeoffset * 3600));
- if($mthread['highlight']) {
- $string = sprintf('%02d', $mthread['highlight']);
- $stylestr = sprintf('%03b', $string[0]);
- $mthread['highlight'] = 'style="';
- $mthread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
- $mthread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
- $mthread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
- $mthread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
- $mthread['highlight'] .= '"';
- } else {
- $mthread['highlight'] = '';
- }
- }
- //----结束
复制代码 这是首页显示代码- <div id="top{$threaddiv_num}" style="display:{$threaddisplay};">
- <!--{loop $mthread $thread}-->
- <div style="overflow: hidden;height: 20px;width: 100%;"><em style="float:right; padding-top:2px;padding-right:5px"><a href="space.php?uid=$thread[authorid]" title="{$_Flang['look_forward']}$thread[author]{$_Flang['look_space']}" target="_blank">$thread[author]</a></em><span style="float:left;padding-right:5px"><a href="viewthread.php?tid=$thread[tid]" $thread['highlight'] title='随机推荐{LF}{$_Flang['forumid']}: $thread[forumname]{LF}{$_Flang['subject']}: $thread[subject]{LF}{$_Flang['author']}: $thread[author]{LF}{$_Flang['posttime']}: $thread[date]{LF}{$_Flang['views']}: $thread[views] {$_Flang['degree']}{LF}{$_Flang['replys']}: $thread[replies] {$_Flang['degree']}{LF}{$_Flang['lastpost']}: $thread[lastreplytime]{LF}{lang lastpost}: $thread[lastposter]{LF}>>>进入信协世界 享受无限精彩'>$thread[view_subject]</a></span></div><div style="clear:both;"></div>
- <!--{/loop}-->
- </div>
-
复制代码 |