开发者

Find out how many pages of results there are from within a paginated CakePHP Controller

I'm using CakePHP's paginate method within a controller. I开发者_StackOverflow社区 wish to find out how many pages of results were generated. This is easy enough within the view ($paginator->counter()) but I'd like to access this information from within the controller itself. Any ideas?


$this->params['paging'][<MODEL NAME>]['pageCount']

try using this. I think it's what you need


A little bit of searching bought this up

$this->params['paging'][$model]['count']

Where $model is your model name.

http://whilefalse.net/2010/11/09/cakephp-get-paginator-count-controller/


In CakePHP 3 you can access the parameters the following way after you have called the method paginate().

$this->request->params['paging']['Model']['count']
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜