sub BuildNextPrevLinks { my ($query,$blankon,$total,$numdisplay,$position) = @_; my ($startno,$endno,$prevstring,$nextstring,$firststring,$laststri +ng); my ($lastpagenum,$laststart); return unless ($total || $blankon); $numdisplay=15 unless $numdisplay; # calculations need to be based on total found not our display tot +al if ($total > $numdisplay) { $startno = $position+1; $endno = $startno + ($numdisplay - 1); $endno = $total if ($endno > $total); } else { # when we have less than the number of rows passed in $startno = 1; $endno = $total; } if ($position>=$numdisplay) { my $newquerystring; my $prevstart = $position - $numdisplay; my $prevlink = &EditQueryString($query,'position',$prevstart); $prevstring="<a href=\"$prevlink\">Previous $numdisplay</a>"; my $firstlink = &EditQueryString($query,'position',0); $firststring="<a href=\"$firstlink\">First $numdisplay</a>"; } else { $prevstring="Previous $numdisplay" if ($blankon); $firststring="First $numdisplay" if ($blankon); } if ($endno<$total){ my $nextstart = $position + $numdisplay; my $how_many_left = $total - $nextstart; if ($how_many_left > $numdisplay) { $how_many_left = $numdisplay; } my $nextlink = &EditQueryString($query,'position',$nextstart); $nextstring="<a href=\"$nextlink\">Next $how_many_left"; $lastpagenum = ($total % $numdisplay); $laststart = $total - $lastpagenum; my $lastlink = &EditQueryString($query,'position',$laststart); $laststring="<a href=\"$lastlink\">Last $lastpagenum</a>"; # $laststring="<a href=\"$lastlink\">Last $lastpagenum</a>"; } else { $nextstring="Next $numdisplay" if ($blankon); $laststring="Last $numdisplay" if ($blankon); } return ($firststring,$prevstring,$nextstring,$laststring,$startno, +$endno); }
In reply to Re: Number of listings per page
by artist
in thread Number of listings per page
by coldfingertips
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |