首页 > CMS > PhpCMS > 正文

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

2024-07-09 22:54:15
字体:
来源:转载
供稿:网友
本文给大家分享的是在phpcms中的手机内容详情页里添加上一篇和下一篇的方法,十分的简单实用,有需要的小伙伴可以参考下。
 

在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').'/');');
                    }

 

在模板中添加

上一页:

 

复制代码代码如下:

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

 

下一页:

 

复制代码代码如下:

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

 

以上所述就是本文的全部内容了,希望大家能够喜欢。


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