2016/05/17 thinkphp3.2.2 Paging use: ① in the home under the Publics folder or under the thinkphp of the library the vender put page.class.php test shell into the ② by the new instantiation method call $page =new \home\publics\page ($total, 3);

Source: Internet
Author: User

There are two ways to pay attention to paging: one is thinkphp3.2 and the other is that the previous page used a slightly different display effect.

Display effect:

Detail questions:

① Search page to add session judgment and paging

② modifying and adding pages requires a session judgment

③ permission settings for adding and deleting changes

Controller side:

1<?PHP2 namespace Home\controller;3  UseThink\controller;4     classUsercontrollerextendsController5     {6          Public functionUser () {7             8             if('? Username ')) {9                 $m=m (' Fruit ');Ten                 //$arr = $m->select (); One //var_dump ($arr); A                 $total=$m-Count(); -                 //$this->assign (' data ', $arr); -                 $this->assign (' Sess ', session (' username '))); the                  -                 $page=New\home\publics\page ($total, 3); -                 //$page->limit;//limit n,n -                 $sql= "SELECT * from Fruit".$page-limit; +                 $lim=$m->query ($sql); -                 $pagelist=$page-fpage (); +                 $this->assign (' Data ',$lim); A                 $this->assign (' list ',$pagelist); at                 $this-display (); -             } -             Else{ -                 $this->redirect (' Login/login '); -             } -              in                  -      to}

Front-end Display:

1<! DOCTYPE html>234<meta charset= "UTF-8" >5<title> Business </title>6<style type= "Text/css" >7A:Link {8Text-decoration:none;9     }Ten</style> One<script type= "Text/javascript" > A     functionJump () { -window.location= "/tp/index.php/home/add/add"; -     } the</script> -<style type= "Text/css" > -         #se{ -             float:Left ; +PositionAbsolute; -Margin-left:150px; +         } A  at</style> - -<body><div id= ' SE ' ><{$sess}> Hello! </div> -<div align= "center" display:inline style= "width:1380px;" > - -<form action= "__url__/search" method= "POST" > in<b> Enquiry </b>&nbsp;&nbsp;&nbsp; Sequence Number: <input type= "text" name= "IDs" > -Name: <input type= "text" name= "name" > toPrice: <input type= "text" name= "Prices" > +Origin: <input type= "text" name= "source" > -<input type= "Submit" value= "Search" ></input> the</form></div><br> *<table border= "1" width= "+" align= "center" > $<tr>Panax Notoginseng<th> Serial Number </th> -<th> name </th> the<th> Price </th> +<th> Origin </th> A<th> Operations </th> the</tr> +<volist name= ' data ' id= ' VO ' > -<tr> $<td><{$vo.ids}></td> $<td><{$vo.name}></td> -<td><{$vo.price}></td> -<td><{$vo.source}></td> the<td><a href= "/tp/index.php/home/user/del/ids/<{$vo.ids}> "> Delete </a> | <a href= "/tp/index.php/home/user/modify/ids/<{$vo.ids}> "> Modify </a></td> -</tr>Wuyi</volist> the  -</table> Wu<div align= "center" ><{$list}></div> -<br> About<center> $<button onclick= "Jump ()" > Add Data </button> -</center> -</body> -View Code

2016/05/17 thinkphp3.2.2 Paging use: ① in the home under the Publics folder or under the thinkphp of the library the vender put page.class.php test shell into the ② by the new instantiation method call $page =new \home\publics\page ($total, 3);

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.