查看: 146|回复: 1

Discuz! 帖子内容页添加上一篇下一篇

[复制链接]
阅读字号:

909

主题

14

回帖

2320

积分

管理员

金钱
1397
发表于 2026-7-9 19:58:51 | 显示全部楼层 |阅读模式

2116.jpg


一、打开 template/default/forum/viewthread_node_body.htm 模板文件,查找:

  1. <!--{elseif $_G[forum_thread][special] == 1}-->
复制代码


在上边添加:

  1. <!--上一篇下一篇-->
  2.                 <!--{eval $next_t=DB::fetch_first("SELECT tid,subject from ".DB::table('forum_thread')." where fid='$_G[fid]' and tid>'$_G[tid]' and displayorder >= 0 order by tid asc limit 1");}-->
  3.                                 <!--{eval $up_t=DB::fetch_first("SELECT tid,subject from ".DB::table('forum_thread')." where fid='$_G[fid]' and tid<'$_G[tid]' and displayorder >= 0 order by tid desc limit 1");}-->
  4.                                         <div class="t_navigation">
  5.                                                 <p class="up_t">
  6.                                                         <em>上一篇:</em>
  7.                                                         <!--{if empty($up_t)}-->
  8.                                                         <span style="font-size: 14px">已经是最后一篇</span>
  9.                                                         <!--{else}-->
  10.                                                         <a href="/thread-<!--{eval echo $up_t[tid];}-->-1-1.html"><!--{eval echo $up_t[subject];}--></a>
  11.                                                         <!--{/if}-->
  12.                                                 </p>
  13.                                                 <p class="next_t">
  14.                                                         <em>下一篇:</em>
  15.                                                         <!--{if empty($next_t)}-->
  16.                                                         <span style="font-size: 14px">已经是最新一篇</span>
  17.                                                         <!--{else}-->
  18.                                                         <a href="/thread-<!--{eval echo $next_t[tid];}-->-1-1.html"><!--{eval echo $next_t[subject];}--></a>
  19.                                                         <!--{/if}-->
  20.                                                 </p>
  21.                                         </div>                          
  22. <!--上一篇下一篇end-->
复制代码


二、打开 template/default/common/common.css 文件,在最下边添加:

  1. /*----------上一篇下一篇----------*/
  2. .t_navigation a{
  3.         font-size: 14px;
  4.         color:#333;
  5.         vertical-align: middle;
  6.         text-decoration: none;
  7. }
  8. .t_navigation a:hover{
  9.         color:red;
  10. }
  11. .up_t{
  12.         margin:20px 0 10px 0;
  13.         overflow: hidden;
  14.         line-height: 22px;
  15. }
  16. .up_t em{
  17.         font-size: 12px;
  18.         color:#ffffff;
  19.         padding: 1px 9px 3px 7px;
  20.         margin:0 10px 5px 0;
  21.         background: #3DA2C2;
  22.         border-radius:4px 4px 4px 4px;
  23. }
  24. .next_t{
  25.         margin:5px 0 5px 0;
  26.         overflow: hidden;
  27.         line-height: 22px;
  28. }
  29. .next_t em{
  30.         font-size: 12px;
  31.         color:#ffffff;
  32.         padding: 1px 9px 3px 7px;
  33.         margin:0 10px 5px 0;
  34.         background: #3DA2C2;
  35.         border-radius:4px 4px 4px 4px;
  36. }
  37. /*----------上一篇下一篇end----------*/
复制代码



回复

使用道具 举报

909

主题

14

回帖

2320

积分

管理员

金钱
1397
 楼主| 发表于 2026-7-27 15:24:00 | 显示全部楼层
X5.0,打开 template\default\forum\viewthread_node.php,查找:

  1. <!--{if !IS_ROBOT && $post['first'] && !$_G['forum_thread']['archiveid']}-->
复制代码


换行添加:

  1. <!--上一篇下一篇-->
  2. <!--{eval $next_t=DB::fetch_first("SELECT tid,subject from ".DB::table('forum_thread')." where fid='$_G[fid]' and tid>'$_G[tid]' and displayorder >= 0 order by tid asc limit 1");}-->
  3. <!--{eval $up_t=DB::fetch_first("SELECT tid,subject from ".DB::table('forum_thread')." where fid='$_G[fid]' and tid<'$_G[tid]' and displayorder >= 0 order by tid desc limit 1");}-->
  4. <div class="t_navigation">
  5.         <p class="up_t">
  6.                 <em>上一篇:</em>
  7.                 <!--{if empty($up_t)}-->
  8.                 <span style="font-size: 14px">已经是最后一篇</span>
  9.                 <!--{else}-->
  10.                 <a href="/thread-<!--{eval echo $up_t['tid'];}-->-1-1.html"><!--{eval echo $up_t['subject'];}--></a>
  11.                 <!--{/if}-->
  12.         </p>
  13.         <p class="next_t">
  14.                 <em>下一篇:</em>
  15.                 <!--{if empty($next_t)}-->
  16.                 <span style="font-size: 14px">已经是最新一篇</span>
  17.                 <!--{else}-->
  18.                 <a href="/thread-<!--{eval echo $next_t['tid'];}-->-1-1.html"><!--{eval echo $next_t['subject'];}--></a>
  19.                 <!--{/if}-->
  20.         </p>
  21. </div>                          
  22. <!--上一篇下一篇end-->
复制代码



回复

使用道具 举报

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

本版积分规则

手机版|小黑屋|网站地图|文强阁

相关侵权、举报、投诉及建议等,请发 E-mail:admin@discuz.vip

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖
返回顶部