Re: paging large amounts of data
| From: | Justin Patrin | Date: | Tue, 23 Aug 2005 16:30:41 +0000 |
| Subject: | Re: paging large amounts of data | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-20545@lists.php.net to get a copy of this message | ||
On 8/23/05, Lukas Smith <lsmith@php.net> wrote:
> Lassiege Hugo wrote:
> > I'm not sure your questions is about PEAR::Pager but if it's the case, maybe
> > this code could help you ?
>
> yes I was ..
>
> > // Number of news per page
> > $nbNewsPerPage = 10;
> >
> > // Number of news
> > $nbNews=$DBNews->getNbNews ();
>
> I presume you are fetching all the news id in the database here ..?
> This is exactly what I want to avoid.
>
> I would rather pass in the total number of items in the database, plus
> the relevant id's, which I can easily determine by getting the current
> page number and the page size.
>
No, you don't need to pass in all of the data. See
Structures/DataGrid/Renderer/HTMLTable.php for an example of a pager
with no data. Basically you just need to pass in 'totalItems'.
--
Justin Patrin