Controller
$ Criteria = new cdbcriteria;
$ Criteria-> order = 'id ASC '; // other SQL statements can be written here.
$ COUNT = bankinfo: Model ()-> count ($ criteria );
$ Pages = new cpagination ($ count );
$ Pages-> pagesize = 1;
$ Pages-> applylimit ($ criteria );
$ Bankinfos = bankinfo: Model ()-> findall ($ criteria );
$ This-> render ('index', array (
'Bankinfos '=> $ bankinfos,
'Pages '=> $ pages,
));
View
<Div class = "green-black">
<? PHP
$ This-> widget ('mylinkpager', array (
'Pages '=> $ pages,
));
?>
</Div>
View with bootstrap // egg pain, only the currentpage attribute is available.
<? PHP if ($ pages-> pagecount> 1):?>
<Div class = "page_margin">
<Ul class = "pagination">
<Li class = "<? PHP echo $ pages-> currentpage <= 0? 'Disabled ': '';?> "> <A href =" <? PHP echo $ pages-> currentpage <= 0? '': $ This-> createurl ('Bank/Index', array ('page' => $ pages-> currentpage);?> "> & Laquo; </a> </LI>
<? PHP for ($ I = 1; $ I <= $ pages-> pagecount; $ I ++):?>
<Li class = "<? PHP echo $ pages-> currentpage + 1 = $ I? 'Activity': '';?> "> <A href =" <? PHP echo $ this-> createurl ('Bank/Index', array ('page' => $ I);?> "> <? PHP echo $ I;?> </A> </LI>
<? PHP endfor;?>
<Li class = "<? PHP echo $ pages-> currentpage + 1 >=$ pages-> pagecount? 'Disabled ': '';?> "> <A href =" <? PHP echo $ pages-> currentpage + 1 >=$ pages-> pagecount? '': $ This-> createurl ('Bank/Index', array ('page' => $ pages-> currentpage + 2);?> "> & Raquo; </a> </LI>
</Ul>
</Div>
<? PHP endif;?>