Re: Pager - some wishes ...
| From: | Lorenzo Alberton | Date: | Fri, 05 Mar 2004 13:22:33 +0000 |
| Subject: | Re: Pager - some wishes ... | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-11108@lists.php.net to get a copy of this message | ||
On Fri, 5 Mar 2004 12:53:39 +0100, Daniel Kopp wrote:
> Maybe someone has an idea how to get what I want with Pager 2.x: -I
> get the data from a database. Actually Pager wants to get a full
> array of the data which is not very perfomant and not necessary.
agreed. In fact Pager was designed to be un-coupled from db.
> If it would be possible to tell the pager how many recordsets there
> are and which page I am going to show I could use LIMIT and just
> get the required data. In this context I do not get what this line
> in the docu means:
> "totalItems [integer] Number of items to page (used only if
> itemData is not provided)." How can I page if there is no data?
if you don't want to page your data (i.e. when
you do it yourself, via LIMIT queries and such)
but you want delegate to Pager the burden
of creating the links for you, then Pager
offers you that facility. Just pass the number
of total items, and Pager will build the links.
> -The same thing could help to get jumps to certain points
> like jumping to certain letters. For example:
> Addresses:
> ..
> -data-
> ..
> 1 2 3 4 5 6 ... 99
> A D G J M P S V Y
> I hope you get what I want ...
again, that's a little out of scope.
Pager will only paginate your data in chunks
of the same size. You could use it in your
address book like this:
$letter = get_addressbook_starting_letter();
$data = get_addresses_starting_with($letter);
//now get a Pager instance, and paginate
//the results WITHIN the selected $letter.
....
HTH
Lorenzo