首页 > 运营 > 帮助中心 > 正文

在phpcms文章中显示上一篇下一篇

2019-10-17 22:29:42
字体:
来源:转载
供稿:网友

要想在phpcms的文章中显示上一篇下一篇,

我们来依照以下步骤来做:

首先:在show.php里"include template("phpcms", $template);"前直接添加以下代码就可以调用了

代码://<添加自定义代码>
$more_pre = $db->get_one("SELECT title,url FROM `".DB_PRE."content` WHERE `contentid`<$contentid and catid="$catid" order by contentid desc limit 0,1");
$more_next = $db->get_one("SELECT title,url FROM `".DB_PRE."content` WHERE `contentid`>$contentid and catid="$catid" order by contentid asc limit 0,1");
//</添加自定义代码>

在模板文件中(show.html)调用方式

代码:<ul>
<li>上一篇: <a href="{$more_pre[url]}" target="_blank">{$more_pre[title]}</a></li>
<li>下一篇: <a href="{$more_next[url]}" target="_blank">{$more_next[title]}</a></li>
</ul>

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表