Manyou诚邀开发者加盟 | 常见问题
《站长》俱乐部官方群公布 城市联络员机会多多
立即免费下载 Discuz!7.0.0 正式版
安装升级指南 | 用户手册 | 新手建站学堂
基于.net架构的Discuz!NT2.6正式版发布
Comsenz公司2009年招贤纳士,期待您的加盟
Discuz!收费服务内容及价格
7月重庆、成都、西安三地社区运营实战特训速报名
Discuz!/UCHome 专用官方虚拟主机
牧场新服一起联运:豆浆机免费带回家
基于Discuz!的免费论坛空间5D6D
康盛创想《站长》俱乐部18城市互动之旅报名ing
返回列表 回复 发帖

内容页显示随机推荐榜【增加百度收录】

1.jpg
2008-10-10 15:48

修改方法

查找 viewthread.htm
  1. <!--{if $post['subject']}-->
  2.        <h2>$post[subject]</h2>
  3.       <!--{/if}-->
复制代码
在后面加上


  1. <!--{if $post['first']}-->
  2. <!--楼主随机显示帖子开始-->
  3. <div class="quote" style="width: 60%; margin:5px 0 10px 0;">
  4.           <center> <h5>随机主题榜</h5></center>
  5.            <blockquote>
  6.            <table border="0" cellpadding="0" cellspacing="0">
  7.               <tr>
  8.                  <td style="border: none; width:50%;" align="left">
  9.            <table border="0" cellpadding="0" cellspacing="0">
  10. <!--{loop $new_digest_threadlist $dthread}-->
  11.     <tr><td><img src='images/default/dotB.png' style='margin-bottom:-3px;' alt='' /><a href="viewthread.php?tid=$dthread[tid]" $dthread['highlight'] title='随机主题 {LF}
  12. 所在论坛: $dthread[forumname]{LF}
  13. 主题标题: $dthread[subject]{LF}
  14. 主题作者: $dthread[author]{LF}
  15. 发表时间: $dthread[date]{LF}
  16. 浏览次数: $dthread[views] 次{LF}
  17. 回复次数: $dthread[replies] 次{LF}
  18. 最后回复: $dthread[lastreplytime]{LF}{lang lastpost}: $dthread[lastposter]'>$dthread[view_subject]</a></td></tr>
  19. <!--{/loop}-->
  20.            </table>
  21.                  </td>
  22.                  <td style="border: none;" align="left">
  23.            <table border="0" cellpadding="0" cellspacing="0">
  24.               
  25. <!--{loop $new_reply_threadlist $rthread}-->
  26.      <tr><td><img src='images/default/dotB.png' style='margin-bottom:-3px;' alt='' /><a href="viewthread.php?tid=$rthread[tid]" $rthread['highlight'] title='最新回复 {LF}
  27. 所在论坛: $rthread[forumname]{LF}
  28. 主题标题: $rthread[subject]{LF}
  29. 主题作者: $rthread[author]{LF}
  30. 发表时间: $rthread[date]{LF}
  31. 浏览次数: $rthread[views] 次{LF}
  32. 回复次数: $rthread[replies] 次{LF}
  33. 最后回复: $rthread[lastreplytime]{LF}{lang lastpost}: $rthread[lastposter]'>$rthread[view_subject]</a></td></tr>
  34. <!--{/loop}-->
  35.            </table>
  36.                  </td>
  37.               </tr>
  38.            </table>
  39.               </blockquote>
  40. </div>
  41. <!--楼主随机显示帖子结束-->
  42. <!--{/if}-->
复制代码
2、查找 viewthread.php

  1. $thread['subjectenc']  = rawurlencode($thread['subject']);
复制代码
在上面加上


  1. //---随机主题开始------------------------------------------
  2. //最新回复
  3. $hack_cut_str = 28; //标题字数,可调整
  4. $hack_cut_strauthor = 9;
  5. $new_reply_threadlist = array();
  6. $rthread = array();
  7. $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");
  8. while($rthread = $db->fetch_array($query)) {
  9.         $rthread['forumname'] = ereg_replace('<[^>]*>','',$rthread['name']);
  10.         $rthread['view_subject'] = cutstr($rthread['subject'],$hack_cut_str);
  11.         $rthread['view_lastposter'] = cutstr($rthread['lastposter'],$hack_cut_strauthor);
  12.         $rthread['date']= gmdate("$dateformat $timeformat", $rthread['dateline'] + $timeoffset * 3600);
  13.         $rthread['lastreplytime']= gmdate("$dateformat $timeformat", $rthread[lastpost] + ($timeoffset * 3600));
  14.         $new_reply_threadlist[] = $rthread;
  15. }
  16. //随机主题
  17. $hack_cut_str = 28; //标题字数,可调整
  18. $hack_cut_strauthor = 9;
  19. $new_digest_threadlist = array();
  20. $dthread = array();
  21. $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");
  22. while($dthread = $db->fetch_array($query)) {
  23.         $dthread['forumname'] = ereg_replace('<[^>]*>','',$dthread['name']);
  24.         $dthread['view_subject'] = cutstr($dthread['subject'],$hack_cut_str);
  25.         $dthread['view_lastposter'] = cutstr($dthread['lastposter'],$hack_cut_strauthor);
  26.         $dthread['date']= gmdate("$dateformat $timeformat", $dthread['dateline'] + $timeoffset * 3600);
  27.         $dthread['lastreplytime']= gmdate("$dateformat $timeformat", $dthread[lastpost] + ($timeoffset * 3600));
  28.         $new_digest_threadlist[] = $dthread;
  29. }
  30. //---随机主题结束------------------------------------------
复制代码
演示  http://bbs.mumutxt.com/
好东东 
这个有利于增加站内链接
代码  看不懂 ·!~!
提示: 作者被禁止或删除 内容自动屏蔽
能不能把它整到帖子内容的下面啊
原帖由 tyiser 于 2008-10-10 17:09 发表
嘻嘻 瞅瞅我的美化版~ (::28:
http://www.xinzheng.cc/bbs/thread-13554-1-1.html
您的不错!分享一下噻!
先收藏了
本帖最后由 远方的回忆 于 2008-10-13 13:00 编辑

回复 5# i5snow 的帖子

第一步的代码
加到:
  1. <div class="box postattachlist">
  2. <h4>{lang attachment}</h4>
  3. $post[attachlist]
  4. </div>
复制代码
下面就行了.

演示:http://www.falcomcn.com/bbs/

忘记说了,我的是6.0的.至于6.1的,这里代码应该差不多.
PS:感谢LZ.
支持先先·~~~~~
这个是好东西
支持
返回列表