thinkcmf 翻页类

thinkphp自带了分页类,使用方法如官方所示

thinkcmf中与thinkphp类似做了自己的分页类

位于

\simplewind\Lib\Util\Page.class.php

大致上这样实例化

[pcsh lang="php" tab_size="4" message="" hl_lines="" provider="manual"]

$page = new \Page($totalsize,$pagesize);

[/pcsh]

使用方法与thinkphp分页类稍有不同

配置方法,大致如下所示

[pcsh lang="php" tab_size="4" message="" hl_lines="" provider="manual"]

    $pagesize = empty($pagesize) ? C('PAGE_SIZE') : $pagesize;
    $page   = new \Vendor\Page($count, $pagesize);
    $config = array(
        "linkwraper_pre" => '<li class="num">',
        "listlong" => C('LIST_LONG'),
        "prev"     => "上一页",
        "next"     => "下一页",
        "list"     => "*",
    );
    $page->SetPager('theme','<div class="pagination">{prev}{list}{next}</div>
        <div class="listnum"> 第 <span>{pageindex}</span> 页/共 <span>{pagecount}</span> 页</div>
        ', $config);
    $show = $page->show('theme');  // 分页按钮
    $list  = $terms->where(array('status' => '1' ))->limit($page->firstRow , $page->listRows)->select();

[/pcsh]

 

 

此处评论已关闭