CakePHP Pagination Recall Component
I've been using the built in pagination in CakePHP 1.2-beta a lot lately and I must say it's freaking awesome. My one oh so minor grievance is that it doesn't "remember" where you were if you navigate off the page. For example many times I'll be paging through a sorted list of records and want to edit a particular one. After I edit and save I'm dropped back to the index with the default sorting on page 1.
I Googled around a bit and skimmed through the pagination code, but didn't see a quick way to turn this type of functionality on. So I wrote a quick component that keeps the sort/page in the session and re-applies it. This is all done automatically by just including the component in your controller.
You can download the component here.
I'll probably submit it to the CakePHP Bakery soon, but was hoping to get some feedback first.

6 Comments
this is an interesting and useful component, thanks for sharing. It's amazing what you can accomplish with <50 lines of code using Cake. :-)
And a small suggestion: if you're proficient enough with the 1.2 pagination, why don't you post some HOWTOs for it? Examples: pagination, pagination w/ AJAX, pagination of a child model, pagination of a child model w/ AJAX etc.. I'm sure there are plenty of folks out there (myself included) that are not familiar enough with pagination to use it well. We would be very grateful :-)
Cheers!
http://bakery.cakephp.org/articles/view/pagination-recall
var $components = array('PaginationRecall');
Thanks for this useful example of extending cake. I was using this kind of behaviour long time in my "legacy" apps.