Fork me on github

phpcms V9实现wap上一篇、下一篇功能

在phpcms\modules\wap\index.php里面,搜索上面这句
if(!$r || $r['status'] != 99) showmessage(L('info_does_not_exists'),'blank');

 找到后,在它的下一行添加上 
 //上一页
$previous_page = $this->db->get_one("`catid` = '$catid' AND `id`<'$id' AND `status`=99",'*','id DESC');
//下一页
$next_page = $this->db->get_one("`catid`= '$catid' AND `id`>'$id' AND `status`=99");
if(empty($previous_page)) {
  $previous_page = array('title'=>L('first_page'), 'thumb'=>IMG_PATH.'nopic_small.gif', 'url'=>'javascript:alert(\''.L('first_page').'\');');
}
if(empty($next_page)) {
  $next_page = array('title'=>L('last_page'), 'thumb'=>IMG_PATH.'nopic_small.gif', 'url'=>'javascript:alert(\''.L('last_page').'\');');
}

最后在模板文件中相应位置添加代码
<P><a href="{WAP_SITEURL}&a=show&catid={$catid}&typeid=1&id={$previous_page[id]}">上一篇:{$previous_page[title]}</a></P>
 <P><a href="{WAP_SITEURL}&a=show&catid={$catid}&typeid=1&id={$next_page[id]}">上一篇:{$next_page[title]}</a></P> 

 

posted @ 2015-12-04 10:57  Champion-水龙果  阅读(370)  评论(0编辑  收藏  举报
Champion-水龙果