mauzilla
mauzilla

Reputation: 3592

cakePHP store pagination parameters and recall on next visit

I am trying to store a state of a paging request. I want users when leaving a page with the cakephp pagination component on (to example edit), on return, be returned to the last page visited with the pagination component.

So if a user visited http://www.site.com/users/view/page:3, and they leave the page, they must be returned to the same page. I tried a pagination recall component I got online but did not manage to get it to work. I am using cakePHP 2.0

Upvotes: 0

Views: 1294

Answers (1)

jeremyharris
jeremyharris

Reputation: 7882

To modify what the paginator uses as it's parameters, you'll need to modify the CakeRequest object on the controller before calling $this->Paginator->paginate().

For example, if the user browsed to /users/index/page:3 and you want to send them to page 4 instead, modify the request in the controller like so:

$this->request->params['named']['page'] = 4;

Upvotes: 2

Related Questions