|
Posted by mootmail-googlegroups on 10/03/06 17:48
comp.lang.php wrote:
>
> However, to paginate to the next page, you'll have to have had stuffed
> THE ENTIRE RESULTSET into a $_SESSION variable and splice that.
>
> That of course is not good. But what on earth else do I do? If I am not
> to use $_SESSION, how would I paginate such an exotic resultset?
>
> Thanx
> Phil
There is no reason to stuff the whole array into the session.
This is no different than any other pagination implementation except
that the data is the combination of two different data sources (but
that fact does not change the difficulty at all). Treat this exactly
as if you were just paging records in a database:
-On each page, limit your output to X elements
-On the link to the 'next' page, pass along an argument which contains
the id (in this case, either the filename or the index of the array
element) with which to begin displaying items on the following page.
-Then, on the next page load, regenerate your array and begin
displaying from the provided id value.
When you're paging records from a database you don't store the entire
resultset in the session, so why would you do any different here?
[Back to original message]
|