Re: Complicated pagination logic problem



comp.lang.php wrote:
'll try to explain this as clearly as possible, sorry if it's unclear.

You have in your directory /foo 42 images

You have in your database metadata for 30 out of those 42 images

You have to display all 42 images in the /foo directory whether they
have database metadata or not.

If any of the 42 images have metadata, you must display the metadata,
else, you don't.

With me so far? Good, it gets wild from here.

You have a requirement for pagination.

Your pagination limit is to only show 20 images at a time.

The only way I know how to do this is to get all of the images out of
the filesystem pertaining to /foo, all of the metadata out of the
database pertaining to /foo, and logically combine them (using
array_merge()) into a single resultset and display, metadata or not.

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

Just put a hidden variable with the next picture to start with on your form. Then after merging the arrays (it might be better to start with an array of filenames not the pictures themselves) use the hidden variable's value to select which part of the array to display.
.



Relevant Pages

  • Re: Complicated pagination logic problem
    ... You have in your database metadata for 30 out of those 42 images ... variable's value to select which part of the array to display. ...
    (comp.lang.php)
  • Complicated pagination logic problem
    ... You have in your database metadata for 30 out of those 42 images ... Your pagination limit is to only show 20 images at a time. ...
    (comp.lang.php)
  • jpg / gif images smeared on IE6-Outlook6
    ... Red X Instead of Images - Can't see or save Images/Pictures ... Change the DPI setting from Large to Normal and see if that helps. ... unchecked to display pictures all the time. ... Please reply to the newsgroup so others may benefit. ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
  • Re: Old issues never die, just fade away
    ... images I try displaying in the e-mail body either by ... either don't display or when they do, they're represented by the red 'x', ... pictures in this message could not be found. ... same thing (using a jpg from another non-iconned sub folder of the same ...
    (microsoft.public.windowsxp.general)
  • re: gifs / jpgs washed out on web pages
    ... I posted before on the issue of not seeing graphics properly. ... I cannot get imiges to display properly. ... Red X Instead of Images - Can't see or save Images/Pictures ... Change the DPI setting from Large to Normal and see if that helps. ...
    (microsoft.public.windows.inetexplorer.ie6.browser)