To achieve the next article, we need to pass a primary key value, we take the news to raise chestnuts, first of all, the news list, I click on the list will go to the content page, so I in the news list when:
Front page:
<span>{$v. A_content}</span><a href= "{$v. a_writer}?id={$v. a_id}" > Read more </a></p></ P></section>
This takes the primary key, and then it goes to the content page.
The content page has a previous article with the next one;
Controller:
<? Public Function index04 () {$this->ff () in the news; $idds = I (' get.id '); Previous $shang = M (' article ')->where ("A_id < $idds and a_keyword=489")->order (' a_id desc ')->limit (' 1 ')-> Find ();//Check data if ($shang) {//To determine if execution succeeds before throwing $this->assign (' Shang ', $shang); } else{//otherwise let his title equal to the temporary no bar $shang [' a_title '] = "temporarily no"; $this->assign (' Shang ', $shang); }//Next post//Ibid $xia = M (' article ')->where ("a_id > $idds and a_keyword=489")->order (' a_id ASC ')->limit (' 1 ')->find (); if ($xia) {$this->assign (' Xia ', $xia); } else{$xia [' a_title '] = "temporarily none"; $this->assign (' Xia ', $xia); } $this->display (' Jiu:public/7-6newsview '); }
Front:
<span class= "prev" > Prev: <a href= "{$shang. a_writer}?id={$shang. a_id}" >{$shang. a_title}</a></ span> <span class= "Next" > Next: <a href= "{$xia. a_writer}?id={$xia. a_id}" >{$xia. a_title}</a ></span>