PHPCMS 如何实现上一篇、下一篇

方法一:直接调用phpcms系统的函数上一篇:{
方法一:直接调用phpcms系统的函数
<div class="info">
    <span>上一篇:<a href="{$previous_page[url]}">{$previous_page[title]}</a></span>
    <span>下一篇:<a href="{$next_page[url]}">{$next_page[title]}</a></span>
</div>

方法二:下面的方法复杂了些,但该代码提供一种phpcms的调用数据的一种思路, 大家可以参考,这也是phpcms区别与其他系统的优势 

上一篇:
{pc:get sql="SELECT * FROM v9_news WHERE id < $id ORDER BY id DESC" num="1" return="p"}
  {loop $p $pv}  
    {php $pid = "id = $pv[id]"}
    {pc:content action="lists" catid="$catid" where="$pid" order="id DESC" num="1"} 
    <ul> 
      {loop $data $key $val}
        <li> <a href="{$val['url']}">{$val['title']}</a></li> 
      {/loop}  
    </ul>  
    {/pc}
  {/loop}
{/pc}  
 
 下一篇:
{pc:get sql="SELECT * FROM v9_news WHERE id > $id ORDER BY id ASC" num="1" return="ne"}
  {loop $ne $nev}  
    {php $neid = "id = $nev[id]"} 
    {pc:content action="lists" catid="$catid" where="$neid" order="id DESC" num="1"} 
    <ul>  
    {loop $data $key $val}
      <li> <a href="{$val['url']}">{$val['title']}</a></li>  
    {/loop}
    </ul> 
    {/pc} 
  {/loop}
{/pc}