Home  >  Article  >  Backend Development  >  Add previous and next articles to phpcms mobile content page_PHP tutorial

Add previous and next articles to phpcms mobile content page_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 09:51:43782browse

Add the previous and next article to the phpcms mobile content page

This article will share with you how to add the previous and next article to the mobile content details page in phpcms The method is very simple and practical, friends in need can refer to it.

In phpcmsmoduleswapindex.php, search for the following sentence

The code is as follows:

 if(!$r || $r['status'] != 99) showmessage(L('info_does_not_exists'),'blank');

After finding it, add

on the next line

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 template

Previous page:

The code is as follows:

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

Next page:

The code is as follows:

 {$next_page[title]}

The above is the entire content of this article, I hope you all like it.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1012361.htmlTechArticlephpcms mobile content page Add previous and next articles This article shares with you the mobile content in phpcms The method of adding the previous and next articles to the details page is very simple and practical, there are...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn