我在Yii中使用自定义分页。我有33件物品。但是yii分页不适用于最后3项。
示例代码:
$total = 33;
$pages =new CPagination($total);
$pages->setPageSize($this->pagesize);
$pages->setCurrentPage($page);
$start = ($pages->currentPage-1)*$pages->pageSize;
$images = array_slice($images,$start,($pages->pageSize));
答案 0 :(得分:0)
这是您的代码
$total = 33;
$pages =new CPagination($total);
$pages->setPageSize($this->pagesize); // $this->pagesize = 10
$start = $pages->currentPage * $pages->pageSize;
$images = array_slice($images,$start,($pages->pageSize));