binoy
binoy

Reputation: 1768

Cakephp2 pagination with GET parameters

I have a list page with a filter form and Im submitting the form using get method. How to pass the querystring parameters along with the pagination links. I have checked this link CakePHP pagination and the get parameters but this->passedArgs is coming as empty. Im using cakephp2. Whats the best option to solve this ?

Upvotes: 1

Views: 1445

Answers (1)

Oldskool
Oldskool

Reputation: 34837

This is some code I use in a CakePHP 1.3 project. I believe it should still work on CakePHP 2.0 as well (put this in the view where your filter form is):

// Make sure we pass any set filters to the Paginator helper
$urlParams = $this->params['url'];
unset($urlParams['url']);

$this->Paginator->options(array('url' => array('?' => http_build_query($urlParams))));

Upvotes: 2

Related Questions