Home >Backend Development >PHP Tutorial >Add previous and next articles to phpcms mobile content page, phpcms previous article_PHP tutorial
In phpcmsmoduleswapindex.php, search for the following sentence
Copy code The code is as follows:
if(!$r || $r['status'] != 99) showmessage(L('info_does_not_exists'),'blank');
After finding it, add
on the next lineCopy code The code is as follows:
//Previous page
$previous_page = $this->db->get_one("`catid` = '$catid' AND `id`<'$id' AND `status`=99",'*','id DESC') ;
//Next page
$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 ').'');');
}
Add
to the templatePrevious page:
Copy code The code is as follows:
< a href="{WAP_SITEURL}&a=show&catid={$catid}&typeid=1&id={$previous_page[id]}" >{$previous_page[title]}
Next page:
Copy code The code is as follows:
{$next_page[title]}
The above is the entire content of this article, I hope you all like it.