php paging class

Posted by Stick it to THE MAN on Stack Overflow See other posts from Stack Overflow or by Stick it to THE MAN
Published on 2010-03-17T10:28:08Z Indexed on 2010/03/17 10:31 UTC
Read the original article Hit count: 290

Filed under:
|
|
|

Can anyone recommend a good PHP paging class?

I have searched google, but have not seen anything that matches my requirements. Rather than "rolling my own" (and almost surely reinventing the wheel), I decided to check in here first.

First some background:

I am developing a website using Symfony 1.3.2 with Propel ORM on Ubuntu 9.10. I am currently using the Propel pager, which is OK, but I recently started using memcache to speed things up a little. At this point, the Propel pager is of little use, as it (AFAIK), only works with Propel objects.

What I need is a class th:t meets the following requirents

  1. Has clean interface, with separation of concerns, so that the logic to retrieve records from the datasource (e.g. database) is encapsulated in a class (or at least a separate file).

  2. Can work with arrays of objects

  3. Provides pagination links, and only fetches the data required for the current page. Also, the pagination should 'split' the available page links if there are too many. For example, if there are potentially 1000 possible page links, the pages displayed should be something like FIRST 2,3 ....999 LAST

  4. Can return the number of all the records in the table being queried, so that the following links are available FIRST, LAST (this requirement is actually already covered in the previous requirement - but I just wanted to re-emphasise it).

Can anyone recommend such a library, if they have used it succesfully in the past?

Alternatively, someobe may have 'hacked' (e.g. derived from) the current Propel pager, to get it to do the things I listed about - please let me know.

© Stack Overflow or respective owner

Related posts about php

Related posts about symfony