|

- 帖子
- 146
- 积分
- 168
- 威望
- 0
- 金币
- 34 个
- 体力
- 61
- 注册时间
- 2008-4-17
|

内容页显示随机推荐榜【增加百度收录】
修改方法
查找 viewthread.htm- <!--{if $post['subject']}-->
- <h2>$post[subject]</h2>
- <!--{/if}-->
复制代码 在后面加上-
- <!--{if $post['first']}-->
- <!--楼主随机显示帖子开始-->
- <div class="quote" style="width: 60%; margin:5px 0 10px 0;">
- <center> <h5>随机主题榜</h5></center>
- <blockquote>
- <table border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td style="border: none; width:50%;" align="left">
- <table border="0" cellpadding="0" cellspacing="0">
- <!--{loop $new_digest_threadlist $dthread}-->
- <tr><td><img src='images/default/dotB.png' style='margin-bottom:-3px;' alt='' /><a href="viewthread.php?tid=$dthread[tid]" $dthread['highlight'] title='随机主题 {LF}
- 所在论坛: $dthread[forumname]{LF}
- 主题标题: $dthread[subject]{LF}
- 主题作者: $dthread[author]{LF}
- 发表时间: $dthread[date]{LF}
- 浏览次数: $dthread[views] 次{LF}
- 回复次数: $dthread[replies] 次{LF}
- 最后回复: $dthread[lastreplytime]{LF}{lang lastpost}: $dthread[lastposter]'>$dthread[view_subject]</a></td></tr>
- <!--{/loop}-->
- </table>
- </td>
- <td style="border: none;" align="left">
- <table border="0" cellpadding="0" cellspacing="0">
-
- <!--{loop $new_reply_threadlist $rthread}-->
- <tr><td><img src='images/default/dotB.png' style='margin-bottom:-3px;' alt='' /><a href="viewthread.php?tid=$rthread[tid]" $rthread['highlight'] title='最新回复 {LF}
- 所在论坛: $rthread[forumname]{LF}
- 主题标题: $rthread[subject]{LF}
- 主题作者: $rthread[author]{LF}
- 发表时间: $rthread[date]{LF}
- 浏览次数: $rthread[views] 次{LF}
- 回复次数: $rthread[replies] 次{LF}
- 最后回复: $rthread[lastreplytime]{LF}{lang lastpost}: $rthread[lastposter]'>$rthread[view_subject]</a></td></tr>
- <!--{/loop}-->
- </table>
- </td>
- </tr>
- </table>
- </blockquote>
- </div>
- <!--楼主随机显示帖子结束-->
- <!--{/if}-->
复制代码 2、查找 viewthread.php-
- $thread['subjectenc'] = rawurlencode($thread['subject']);
复制代码 在上面加上-
- //---随机主题开始------------------------------------------
- //最新回复
- $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 AND f.fid not in (0) AND t.displayorder not in (-1,-2) ORDER BY t.lastpost DESC LIMIT 0, 5");
- while($rthread = $db->fetch_array($query)) {
- $rthread['forumname'] = ereg_replace('<[^>]*>','',$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));
- $new_reply_threadlist[] = $rthread;
- }
- //随机主题
- $hack_cut_str = 28; //标题字数,可调整
- $hack_cut_strauthor = 9;
- $new_digest_threadlist = array();
- $dthread = 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|%' ORDER by rand() DESC LIMIT 0, 5");
- while($dthread = $db->fetch_array($query)) {
- $dthread['forumname'] = ereg_replace('<[^>]*>','',$dthread['name']);
- $dthread['view_subject'] = cutstr($dthread['subject'],$hack_cut_str);
- $dthread['view_lastposter'] = cutstr($dthread['lastposter'],$hack_cut_strauthor);
- $dthread['date']= gmdate("$dateformat $timeformat", $dthread['dateline'] + $timeoffset * 3600);
- $dthread['lastreplytime']= gmdate("$dateformat $timeformat", $dthread[lastpost] + ($timeoffset * 3600));
- $new_digest_threadlist[] = $dthread;
- }
- //---随机主题结束------------------------------------------
复制代码 演示 http://bbs.mumutxt.com/ |
|