I'd like to pass in the pageCount instead of have the PaginatorHelper class get it off the model. The reason is that I'm not using the model at all.

Is there any way to do this?

有帮助吗?

解决方案

Internally the params are stored in $this->request->params['paging'][$model], where $model is the name of the desired model. The exact data in this variable can be found in the Cake docs. You will always need a name of a model, but you can make one up.

In your controller:

$this->request->params['paging']['MyModel'] = array(
   'pageCount' => 3
);

In your view:

$this->Paginator->param('pageCount', 'MyModel');
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top