要想在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>
新聞熱點
疑難解答