Pagination Class http://blog.csdn.net/buyingfei8888/article/details/40260127
The paging class is placed in the component and the file name is consistent
Where is the component loaded in? In the main configuration file
It is also divided into 4 steps to achieve paging effect:
Controller:
function ActionShow1 () {$good _model = Goods::model (); $good _info = $good _model->findall (); Sets the total number and the number of displays per page $cnt = $good _model, count (); $per = 6; 1 Instantiating Object $page = new Pagination ($cnt, $per); 2 reassemble the SQL statement $sql = "Select * from {{goods}} $page->limit"; $good _info = $good _model->findallbysql ($sql); 3 Display the paging list $page _list = $page->fpage (Array (3,4,5,6,7)); echo $page _list; 4 Divide it into
With template $this->renderpartial (' Show ', Array (' goods_infos ' = ' + ' $good _info, ' page_list ' = = $page _list)); }
Display the following code in the template (where paging is required)
<?php echo $page _list;? >
It's so casual.
Effect:
If you want to show more effects, change the above controller.
3 Display page List//$page _list = $page->fpage (Array (3,4,5,6,7)), $page _list = $page->fpage ();
Effect
For Mao to do this, look at the pagination class original code:
Combine the PHP paging class with the YII framework and change the style as needed