您现在的位置是:首页 > 网站建设网站建设

帝国 CMS把上一篇、下一篇都统一截成 20 字(可自行改数字)

2025-08-18 23:36:13【网站建设】人已围观

简介帝国 CMS把上一篇、下一篇都统一截成 20 字(可自行改数字)

<?php
/* --------- 上一篇 --------- */
$pre = $empire->fetch1("select titleurl,title from {$dbtbpre}ecms_news where id<$navinfor[id] and classid=$navinfor[classid] order by id desc limit 1");
$preHtml = $pre
    ? '<a href="'.$pre['titleurl'].'">'.esub($pre['title'],20,'…').'</a>'
    : '没有了';

/* --------- 下一篇 --------- */
$next = $empire->fetch1("select titleurl,title from {$dbtbpre}ecms_news where id>$navinfor[id] and classid=$navinfor[classid] order by id asc limit 1");
$nextHtml = $next
    ? '<a href="'.$next['titleurl'].'">'.esub($next['title'],20,'…').'</a>'
    : '没有了';
?>

<div class="prev-next">
    <span class="prev">上一篇:<?php echo $preHtml; ?></span>
    <span class="next">下一篇:<?php echo $nextHtml; ?></span>
</div>

<style>
.prev-next{font-size:14px;margin-top:20px;}
.prev-next span{display:block;margin:5px 0;}
</style>

Tags:

很赞哦! ()

文章评论

    共有条评论来说两句吧...

    您的昵称: