简体   繁体   中英

How can I set the paginator page from within the controller in cakePHP

I have a standard cakePHP backend but I'm not using the cake pagination helper. My existing frontend provides pagination params in the form "startIndex, numberOfResults" vs. "page". It would be great if from within the controller action I could just parse my startIndex, numberOfResults params, calc the proper page and then do something like:

paginate['page'] = $pageNumber;

before the paginate() call. No such luck. So my question is, how can I set the paginator page from within the controller? As a bonus: Where is cake parsing the page named param? Where does it store the page value used for the paginate call?

Since It's a 1.2 application. You should try changing $this->params['url']['page'] like this:

      $this->params['url']['page'] = $pageNumber;

Source: CakePHP 1.2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM