Detailed example of thinkphp paging integration

小云云
Release: 2023-03-19 20:46:01
Original
1447 people have browsed it

This article mainly brings you an example of thinkphp paging integration. The editor thinks it is quite good, so I will share it with you now and give it as a reference for everyone. Let’s follow the editor to take a look, I hope it can help everyone.

Controller:

$User = M('webcase'); // 实例化 User 对象

$list = $User->order('id desc')->page($_GET['p'].',6')->select();
$this->assign('list',$list);// 赋值数据集
$count = $User->count();// 查询满足要求的总记录数
$Page = new \Think\Page($count,6);// 实例化分页类 传入总记录数和每页显示的记录数
$show = $Page->show();// 分页显示输出
$this->assign('page',$show);// 赋值分页输出

$this->display(); // 输出模板
Copy after login

View:

<volist name=&#39;list&#39; id=&#39;new&#39; >
 <tr class="content">
  
<td><a href="/?m=home&c=index&a=detail&id2={$new.id}" rel="external nofollow" > {$new.keyword}</a></td>
        </tr>
        </volist>
      <tr class="content">
        <td colspan="3" bgcolor="#FFFFFF"><p class="pages">
            {$page}
        </p></td> 
      </tr>
Copy after login

Related recommendations:

Examples of paging integration in the TP framework

The above is the detailed content of Detailed example of thinkphp paging integration. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template