Google

Monday, May 25, 2009

CakePHP - Pagination

I've spent quite sometimes looking for this information, after lots of trial and errors I've found the solution.

If you want to know what is the param to be inserted in
$paginator->prev("Previous", null);

The second parameter has to be like below:
array("url"=>array("limit:".$limit)), url is fixed. In the array "name_of_param":"value_of_param"

If you have dynamic limit in your page, and you want to maintain it when you click on Previous or Next. This is the solution you need.


By the way, if your CakePHP is not up to date (like mine), when you want to do a toggle sort for your TH, the default function might not work. Update your pagination.php to this version:
https://trac.cakephp.org/changeset/8125

Then you'll be able to toggle this sort('Name', 'name')?>


Good luck!

No comments: