I'm building a cakePHP app which uses pagination. At one point, I need the controller to check certain conditions, and, if they are met, to reset to the first of the paginated pages.
In other words, let's say the url is http://www.example.com/films/index/page:6
In the films controller, I have:
function index() {
if(conditions are met)
$this->params['named']['page'] = 1;
}
The idea being that if the conditions are met, then the paginator will show the first page of results rather than page 6.
I've checked that the conditions are being met, and the parameter ['named']['page'] is changed, but the paginator seems to be ignoring it and showing page 6 regardless.
What am I doing wrong?
Thanks!