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 rel="nofollow noopener noreferrer" href="{WAP_SITEURL}&a=show&catid={$catid}&typeid=1&id={$previous_page[id]}" >{$previous_page[title]}</a>

下一页:


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

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

本文phpcms手机内容页面添加上一篇和下一篇到此结束。别让情绪左右着你的每一天小编再次感谢大家对我们的支持!

您可能有感兴趣的文章
yii2实现 "上一篇,下一篇" 功能的代码实例

PHP实现上一篇下一篇的方法实例总结

Laravel 中获取上一篇和下一篇数据