把下列代码加入到show.html的相关位置:
-
{get sql='SELECT * FROM `phpcms_content` WHERE `contentid` > $contentid AND `catid` = $catid and status=99 order by contentid asc' return='r1' rows='1'}
{php $front=1;}上一篇:{str_cut($r1[title], $titlelen)}
{/get}
{if $front!=1}上一篇:没有了{/if}
{get sql='SELECT * FROM `phpcms_content` WHERE `contentid` < $contentid AND `catid` = $catid and status=99 order by contentid desc' return='r2' rows='1'}
{php $next=1;}下一篇:{str_cut($r2[title], $titlelen)}
{/get}
{if $next!=1}下一篇:没有了{/if}
本文提供了一段用于实现PHP网站中文章上下篇导航功能的代码示例。该代码通过SQL查询获取当前文章的上一篇及下一篇内容,并展示在页面上。
168

被折叠的 条评论
为什么被折叠?



