Alvaro
Alvaro

Reputation: 41605

Converting named parameters to GET parameters for pagination at CakePHP 2.2

I am trying to convert named parameters to GET parameters for pagination at CakePHP 2.2 following the instructions given in the documentation but it is not working.

Instead of this:

http://localhost/cake/posts/yourPosts/page:2?url=posts%2FyourPosts

I want this:

http://localhost/cake/posts/yourPosts/?page=2&url=posts%2FyourPosts

The thing is, when i submit a form using GET method, i don't want to retain the current page, and currently, it is doing it by default because it is not a normal param but a named param.

(?url=posts%2FyourPosts is added automatically with the GET method)

I have tried to to this in my view but it stills passing the parameter as a named one:

$this->Paginator->options(array('convertKeys' => array('page')));

echo $this->Paginator->next(' >', array('class' => 'button next right'), null, array('class' => 'next button'));

What am I doing wrong?

Upvotes: 0

Views: 2020

Answers (1)

mark
mark

Reputation: 21743

you should fix the issue at its source, not cloaking it: http://book.cakephp.org/2.0/en/core-libraries/components/pagination.html#pagination-with-get-parameters

public $paginate = array(
    'paramType' => 'querystring'
);

in your controller

Upvotes: 2

Related Questions