1
我使用cakephp 2.5.6,我想在我的视图文件中显示数组。我尝试将CakePHP默认分页与此数组,但它不起作用。这里是我的示例代码如何将cakephp默认分页数组
---'my_pages' controller-----
public function view(){
//some other code
$resultArray = $this->MyPages->getResults();
$resultArray = $this->Paginator->paginate('resultArray');
$this->set(compact('resultArray','rightPanel'));
}
和我的视图文件
----- 'view.ctp' file ------
//some other code
foreach ($resultArray as $result){
echo $result['subject'];
echo $result['body'];
}
在我的情况下,该$resultArray
有近百元素,我想把分页此页面上。那么是否有可能在这种情况下使用cakephp默认分页?谢谢:)
谢谢:),当我把你的答案它的工作。但鉴于每页页面项目不能正常工作,我尝试了很多方法,但似乎不工作。使用调试器显示分页限制和其他变量是正确的。但当前页面显示9.不知道为什么是这样,你有一个想法,为什么它的行为是这样的。 – indrarajw 2015-03-05 13:34:43