随机推荐代码:
不需要修改任何文件,只在后台插件设置,添加模块即可。(下方截图)- //随机
- $hack_cut_str = 48; //标题字数
- $hack_cut_strauthor = 9;
- $new_hot_threadlist = array();
- $sjthread = 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($sjthread = $db->fetch_array($query)) {
- $sjthread['forumname'] = ereg_replace('<[^>]*>','',$sjthread['name']);
- $sjthread['view_subject'] = cutstr($sjthread['subject'],$hack_cut_str);
- $sjthread['view_lastposter'] = cutstr($sjthread['lastposter'],$hack_cut_strauthor);
- $sjthread['date']= gmdate("$dateformat $timeformat", $sjthread['dateline'] + $timeoffset * 3600);
- $sjthread['lastreplytime']= gmdate("$dateformat $timeformat", $sjthread[lastpost] + ($timeoffset * 3600));
- if($sjthread['highlight']) {
- $string = sprintf('%02d', $sjthread['highlight']);
- $stylestr = sprintf('%03b', $string[0]);
- $sjthread['highlight'] = 'style="';
- $sjthread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
- $sjthread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
- $sjthread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
- $sjthread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
- $sjthread['highlight'] .= '"';
- } else {
- $sjthread['highlight'] = '';
- }
- $new_hot_threadlist[] = $sjthread;
- }
- //----结束
- foreach ($new_hot_threadlist as $sjthread){
- echo "<div style="overflow: hidden;height: 20px;width: 100%;"><em style="float:right; padding-top:2px;padding-right:5px"><a href="space.php?uid=$sjthread[authorid]" title="{$_Flang[look_forward]}$sjthread[author]{$_Flang[look_space]}" target="_blank">$sjthread[author]</a></em><span style="float:left;padding-right:5px"><a href="viewthread.php?tid=$sjthread[tid]" $sjthread[highlight] title='随机推荐\n{$_Flang[forumid]}: $sjthread[forumname]\n{$_Flang[subject]}: $sjthread[subject]\n{$_Flang[author]}: $sjthread[author]\n{$_Flang[posttime]}: $sjthread[date]\n{$_Flang[views]}: $sjthread[views] {$_Flang[degree]}\n{$_Flang[replys]}: $sjthread[replies] {$_Flang[degree]}\n{$_Flang[lastpost]}: $sjthread[lastreplytime]\n{$_Flang[lastpost]}: $sjthread[lastposter]\n>>>welcom'>$sjthread[view_subject]</a></span></div><div style="clear:both;"></div>";
- }
复制代码 演示:http://www.ita-biti.com/bbs/
非常感谢楼主的帮助~~~
另外希望楼主在一楼放个本帖的链接,方便大家看到。 |