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


在phpcmsmoduleswapindex.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>

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

Yii获取当前url和域名的方法
本文实例讲述了Yii获取当前url和域名的方法。分享给大家供大家参考。具体如下:假设我们当前页面的访问地址是:http://localhost/CMS/public/index.phpr=news&id=

CodeIgniter使用smtp服务发送html邮件的方法
本文实例讲述了CodeIgniter使用smtp服务发送html邮件的方法。分享给大家供大家参考。具体如下:codeigniter提供的email类,用于发送邮件,wiki地址:http://code

smarty模板判断数组为空的方法
本文实例讲述了smarty模板判断数组为空的方法。分享给大家供大家参考。具体如下:这里主要介绍两种方法:1.用count来取得数组的下标个数下面例子中