TP3.2 Implementing the context switch

Source: Internet
Author: User
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>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.