6 Tutorials On Adding Pagination In CakePHP

1. Custom Query Pagination

A good example of when you would need this is if the underlying DB does not support the SQL LIMIT syntax. This is true of IBM’s DB2. You can still use the CakePHP pagination by adding the custom query to the model.

Should you need to create custom queries to generate the data you want to paginate, you can override the paginate() and paginateCount() model methods used by the pagination controller logic.

2. CakePHP Advanced Pagination – sort by derived field

I spent a couple of hours to find out a way… and finally got it! yes it is possible to sort by derived fields using the built-in pagination feature of cakephp! Let’s talk about the solution a little later, first I’d like to introduce you with the exact problem I faced.

3. Pagination with custom find types in CakePHP

What I’m going to talk about is how to mix your custom find types with pagination, without having to use paginate and paginateCount in your models.

4. Creating Simple Ajax Pagination with CakePHP 1.3 and Mootools

Creating ajax pagination has gotten more simple and flexible for 1.3. In 1.2 you could only use the built in Ajax pagination if you were using Prototype as your javascript library. With the addition of the JsHelper you can use any Javascript library that an engine has been implemented. My example today will be using mootools. I’ll be basing this, off of a freshly baked index view using the default core templates.

5. Custom Pagination in CakePHP

To continue on last weeks thought of a “lite” forum, I needed 2 tables (Forums, Posts). Since this is a “lite” forum, I did not want to create a mid-table labeled topics, so I incorporated that in the Posts table. The other reasoning behind this, is that to create a hybrid forum/blog, the topic is really just a beginning post in the thread, so keep those in the Posts table, just mark it as a topic to differentiate this from the other posts.

6. CakePHP Part 6 – Pagination!

Pagination is something that any decent site has in it somewhere. The whole idea is to give the user pages of information to look through, instead of just listing all the data at once. Not only does this cut down on page load times, but it is also a great way to view and organize the information as well. And like always, Cake makes this task just as easy as a few lines of code.


Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.