请选择 进入手机版 | 继续访问电脑版
设为首页收藏本站

Discuz! 官方站

 找回密码
 立即注册

QQ登录

只需一步,快速开始

Discuz! X 最新研发动态 通过这个窗口,关注跟踪我们的研发进展 Discuz! 开发技术文库 - 给官方提建议

Discuz! X2 正式版下载 帮助网站实现一站式服务  商业支持服务咨询 下载 - 安装 - 常见问题 - 转换 - 讨论 - 购买

2012站长年会开启报名 限量船票免费发放 年会“船票”每日审核名单公布 - Discuz!NT3.6发布 漫游引入QQ空间游戏 -一骑新区横扫三国-5d6d免费论坛

查看: 2231|回复: 21

[发布] 内容页显示随机推荐榜【增加百度收录】 [复制链接]

Rank: 4

UID
921245
积分
766
帖子
723
威望
0
在线时间
102 小时
注册时间
2008-4-17
发表于 2008-10-10 15:48:08 |显示全部楼层
1.jpg

修改方法

查找 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/
淘宝特卖网:http://www.8mob.com,
淘宝网女装:http://www.taokestore.cn/,
导购网:http://huangguan.iegoon.cn,
特卖网:http://www.860sy.com

Rank: 2

UID
636073
积分
130
帖子
119
威望
0
在线时间
1 小时
注册时间
2007-2-9
发表于 2008-10-10 16:00:20 |显示全部楼层
好东东 
这个有利于增加站内链接

使用道具 举报

Rank: 6Rank: 6

UID
986868
积分
1030
帖子
1232
威望
0
在线时间
0 小时
注册时间
2008-9-1
发表于 2008-10-10 16:16:22 |显示全部楼层
代码  看不懂 ·!~!

使用道具 举报

头像被屏蔽

Banned to Post

UID
966856
积分
377
帖子
423
威望
0
在线时间
0 小时
注册时间
2008-7-24
发表于 2008-10-10 17:09:25 |显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽

使用道具 举报

Rank: 6Rank: 6

UID
927
积分
1415
帖子
1259
威望
-5
在线时间
147 小时
注册时间
2002-6-17
发表于 2008-10-10 17:29:12 |显示全部楼层
能不能把它整到帖子内容的下面啊

使用道具 举报

Genius

阿牧

Rank: 12Rank: 12Rank: 12

UID
998880
积分
12739
帖子
12292
威望
27
在线时间
1075 小时
注册时间
2008-9-27
发表于 2008-10-10 17:34:30 |显示全部楼层
原帖由 tyiser 于 2008-10-10 17:09 发表
嘻嘻 瞅瞅我的美化版~ (::28::)
http://www.xinzheng.cc/bbs/thread-13554-1-1.html

您的不错!分享一下噻!
如今这世界畜生越来越多,肉却是一点也没有便宜。

使用道具 举报

Rank: 1

UID
996017
积分
32
帖子
32
威望
0
在线时间
0 小时
注册时间
2008-9-21
发表于 2008-10-12 17:15:45 |显示全部楼层
先收藏了

使用道具 举报

Rank: 3Rank: 3

UID
507703
积分
456
帖子
398
威望
0
在线时间
113 小时
注册时间
2006-12-2
发表于 2008-10-13 12:46:40 |显示全部楼层
本帖最后由 远方的回忆 于 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.

使用道具 举报

Rank: 3Rank: 3

UID
910955
积分
231
帖子
90
威望
0
在线时间
1 小时
注册时间
2008-3-26
发表于 2008-10-13 15:12:07 |显示全部楼层
支持先先·~~~~~

使用道具 举报

Rank: 8Rank: 8

UID
303244
积分
7169
帖子
8638
威望
5
在线时间
1 小时
注册时间
2006-1-5
发表于 2008-10-13 15:38:29 |显示全部楼层
这个是好东西
支持

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

fastpost

手机版|Archiver|北京康盛新创科技有限责任公司 ( 京ICP证110024号|京网文[2011]0019-007号 )  

GMT+8, 2012-2-13 13:05 , Processed in 0.117319 second(s), 16 queries , Memcache On.

Powered by Discuz! X2

© 2001-2011 Comsenz Inc.

回顶部