修改方法,以默认模板为例:
1)打开 news_view.html.php 找到下面的代码
代码:
<div id="articledetail" class="block topblock">
;<h3 style="font-weight: normal;">
; <a href="javascript:;" onclick="showajaxdiv('{S_URL}/batch.common.php?action=emailfriend&itemid=$news[itemid]', 400);" class="more">推荐给好友</a>
; <a href="{S_URL}/batch.common.php?action=viewnews&op=up&itemid=$news[itemid]&catid=$news[catid]" class="viewnewsup">上一篇</a> |
; <a href="{S_URL}/batch.common.php?action=viewnews&op=down&itemid=$news[itemid]&catid=$news[catid]" class="viewnewsdown">下一篇</a>
;</h3>
;<h1 class="articletitle" style="$news[styletitle]">$news[subject]</h1>
;<p class="articleinfo">
; <span class="articlectrl">
;;;字体:
;;;<a href="javascript:doZoom('12');">小</a>
;;;<a href="javascript:doZoom('14');">中</a>
;;;<a href="javascript:doZoom('16');">大</a>;;|
;;;<a href="javascript:doPrint();" class="btnprint">打印</a>
; </span>
; <span class="smalltxt">发布: #date('Y-n-d H:i', $news["dateline"])#; ; 作者: $news[newsauthor]; ; 来源: <!--{if !empty($news[newsfromurl])}--><a href="$news[newsfromurl]" target="_blank" title="$news[newsfrom]">$news[newsfrom]</a><!--{else}-->$news[newsfrom]<!--{/if}--> 查看: $news[viewnum]次</span>
;</p>
;<!--{if !empty($news[custom][name])}-->
;<br />
;<div id="custominfo">
; <h5>$news[custom][name]</h5>
; <ul>
; <!--{loop $news[custom][key] $ckey $cvalue}-->
;;;<li><strong>$cvalue[name]: </strong>$news[custom][value][$ckey]</li>
; <!--{/loop}-->
; </ul>
;</div>
;<!--{/if}-->
;<div id="articlebody">
;$news[message]
;<!--{if empty($multipage)}-->
;<!--{loop $news['attacharr'] $attach}-->
;<br /><a href="$attach[url]" target="_blank"><img src="$attach[thumbpath]" alt="$attach[subject]" /></a><br />$attach[subject]<br />
;<!--{/loop}-->
;<!--{/if}-->
;<br />
;<!--{if !empty($relativetagarr)}-->
;<br /><strong>TAG:</strong>
;<!--{loop $relativetagarr $value}-->
;<!--{eval $svalue = rawurlencode($value);}-->
;<a href="#action/tag/tagname/$svalue#" target="_blank">$value</a>
;<!--{/loop}-->
;<!--{/if}-->
;
;</div>
;<!--{if $multipage}-->
;<div class="pages">
; $multipage
;</div>
;<!--{/if}-->
</div>
在最后的这个</div>上面添加以下代码:
代码:
;<ul class="msgtitlelist">
; <li>上一篇:<a href="{S_URL}/batch.common.php?action=viewnews&op=up&itemid=$news[itemid]&catid=$news[catid]" class="viewnewsup">$title_a</a></li>
; <li>下一篇:<a href="{S_URL}/batch.common.php?action=viewnews&op=down&itemid=$news[itemid]&catid=$news[catid]" class="viewnewsdown">$title_b</a></li>
;</ul>
布局可根据自己的情况修改,链接代码不要改。
2)打开SS安装目录下的 viewnews.php 文件,在最下部找到:
代码:
include template($tplname);
ob_out();
if(!empty($_SCONFIG['htmlviewnews'])) {
ehtml('make');
} else {
maketplblockvalue('cache');
}
?>
在这段代码上面添加以下代码:
代码:
//调用上一篇资讯标题
$title_a = $_SGLOBAL['db']->result($_SGLOBAL['db']->query('SELECT subject FROM '.tname('spaceitems').' WHERE itemid < ''.$itemid.'' AND catid = ''.$thecat['catid'].'' AND folder='1' AND type='news' ORDER BY itemid DESC LIMIT 0,1'), 0);
if(!$title_a) $title_a = '已经没有了';
//调用下一篇资讯标题
$title_b = $_SGLOBAL['db']->result($_SGLOBAL['db']->query('SELECT subject FROM '.tname('spaceitems').' WHERE itemid > ''.$itemid.'' AND catid = ''.$thecat['catid'].'' AND folder='1' AND type='news' ORDER BY itemid LIMIT 0,1'), 0);
if(!$title_b) $title_b = '已经没有了';
//代码结束