Re: PEAR::Pager question
| From: | Lorenzo Alberton | Date: | Mon, 15 Nov 2004 09:28:38 +0000 |
| Subject: | Re: PEAR::Pager question | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-15502@lists.php.net to get a copy of this message | ||
Hi,
Steffen Eckardt wrote:
Just spotted a problem when I first tried using the PEAR::Pager class. I can assign the number of pages to be listed with "totalItems" or as an array via "itemData". So far so good. For instance the "itemData"-array could look like this: $array = array("a", "b", ... , "z"); When I then build the links the class returns the pagination in the following form: http://SERVER/FILE?pageID=1 to http://SERVER/FILE?pageID=26 But I need the class to work with the values assigned by the "itemData"-array. That should look like: http://SERVER/FILE?pageID=a to http://SERVER/FILE?pageID=z Is that possible? If not the possibility to assign an array would be absolutely useless in every case, wouldn't it?you're confusing the data to be paged with the number of the page(s) containing the paged data. If you have $itemData = array("a", "b", ... , "z"), and you set $perPage = 5, then you'll get 6 pages, from 1 to 6, each one (but the last one) containing 5 elements from the $itemData array. The links are built with the page number, not with the value of the first item in the page. Please look at the docs, try the examples to have a better idea: http://pear.php.net/manual/en/package.html.pager.php HTH Regards, -- Lorenzo Alberton http://pear.php.net/user/quipo