Home  >  Article  >  Backend Development  >  Add previous and next articles to phpcms mobile content page, phpcms previous article_PHP tutorial

Add previous and next articles to phpcms mobile content page, phpcms previous article_PHP tutorial

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

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

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 line

Copy 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 template

Previous 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.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1011944.htmlTechArticleAdd the previous and next articles to the phpcms mobile content page, and the phpcms previous article is in phpcmsmoduleswapindex.php, search The following copy code is as follows: if(!$r || $r['status'] !...
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