in reply to mathematical equation

This still seems kind of weird or hard to think about. But think about it like this.

Page 1 shows items 0 - 19, right?
Page 2 shows items 20 - 40 (which works fine, no duplicates)
Page 3 would show items 40 - 60 (first duplicate (#40)
Page 4 would show items 60 - 80 (next duplicate (#60)

After page two your last item on the patch will duplicate the first item on the next page (in a consecutive ++). I don't know if this would work, but maybe add another <if> statement that does something like:

my $page = url_param('page'); if ($page > 2) { my $top = $page * 20); my $bottom = $top - 19;


"Age is nothing more than an inaccurate number bestowed upon us at birth as just another means for others to judge and classify us"

sulfericacid

Replies are listed 'Best First'.
Re: Re: mathematical equation
by sauoq (Abbot) on Jul 28, 2003 at 06:59 UTC

    See my comments at my other reply to you.

    Replace the latter half of your "galleryprint.pl" script with something like this:

    my $page = url_param('page'); $page ||= 1; my $first = ($page - 1) * 20; my $last = $first + 19; print "<table>\n"; my $counter = 0; for ( (grep defined, reverse keys %upload)[ $first .. $last ] ) { my ( $filename, $width, $height ) = split ( /::/, $upload{$_} ); print " <tr>" unless ( $counter % 5 ); print qq(<td width=120" height="120">), qq(<a href="$imagedir/$filename" target="new">), qq(<img src="$imagedir/$filename" height="100" width="100">) +, qq(</a></td>); unless ( ++$counter % 5 ) { print "</tr>\n"; } } print "</table>";
    I renamed the variables $first and $last to avoid the ambiguity of $bottom and $top I.e. It wasn't easy to tell whether you meant "bottom of page" or "bottom of range" (The bottom of the page would be the top of the range.) Whereas, $first is unambiguous because it is both the first image on the page and the first index in the range. Likewise with $last.

    -sauoq
    "My two cents aren't worth a dime.";