Question

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?

Was it helpful?

Solution

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');
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top