您现在的位置: 万盛学电脑网 >> 程序编程 >> CMS教程 >> 正文

phpcms手机内容页面添加上一篇和下一篇的教程

作者:佚名    责任编辑:admin    更新时间:2022-06-22

class="area">              今天电脑知识吧的小编为大家带来一篇教程:“phpcms手机内容页面添加上一篇和下一篇的教程”,希望可以帮助到各位站长们,具体如下:在phpcms\modules\wap\index.php里面,搜索下面这句
  1. if(!$r || $r['status'] != 99) showmessage(L('info_does_not_exists'),'blank');
复制代码找到后,在它的下一行添加上
  1. //上一页
  2. $previous_page = $this->db->get_one("`catid` = '$catid' AND `id`<'$id' AND `status`=99",'*','id DESC');
  3. //下一页
  4. $next_page = $this->db->get_one("`catid`= '$catid' AND `id`>'$id' AND `status`=99");
  5. if(empty($previous_page)) {
  6.                             $previous_page = array('title'=>L('first_page'), 'thumb'=>IMG_PATH.'nopic_small.gif', 'url'=>'javascript:alert(\''.L('first_page').'\');');
  7.                     }
  8.                     if(empty($next_page)) {
  9.                             $next_page = array('title'=>L('last_page'), 'thumb'=>IMG_PATH.'nopic_small.gif', 'url'=>'javascript:alert(\''.L('last_page').'\');');
  10.                     }
复制代码

在模板中添加

上一页:

  1. < a href="{WAP_SITEURL}&a=show&catid={$catid}&typeid=1&id={$previous_page[id]}" >{$previous_page[title]}</a>
复制代码

下一页:

  1. <a href="{WAP_SITEURL}&a=show&catid={$catid}&typeid=1&id={$next_page[id]}" >{$next_page[title]}</a>
复制代码