# of thumbnails per page user changeable
Brought to you by:
panthar
This patch allows users to change the number of
thumbnails per page.
The config.inc sports 3 new settings,
items_per_page_min/max/default. And items_per_age has
been retired =)
To see it in action visit http://www.quakeconpics.com/
Logged In: YES
user_id=447148
The file upload failed so here's the patch in txt format:
--- functions.inc.orig Sun Jan 27 15:22:25 2002
+++ functions.inc Sat Feb 2 15:16:09 2002
@@ -37,10 +37,11 @@
global $realbase;
global $dispsize;
global $sitehome;
+
global $perpage;
if ($sitehome != '') {
-
print "<A HREF=\&quot;$sitehome\&quot;>Home</a> -> \n";
+
print "<A HREF=\&quot;$sitehome?perpage=$perpage\&quot;>Home</a> -> \n";
}
-
print "<A HREF=" . dirname($SCRIPT_NAME) .
"?dispsize=$dispsize>Albums</a>\n";
+
print "<A HREF=" . dirname($SCRIPT_NAME) .
"?dispsize=$dispsize&perpage=$perpage>Albums</a>\n";
$doo = split("/",$path);
$prepath = '';
while (list($foo,$filename) = each($doo)) {
@@ -52,7 +53,7 @@
-
print " -> <A HREF=?mode=album&album=" . urlencode($fullname)
. "&dispsize=$dispsize&start=$start>$filename</a>\n";
+
print " -> <A HREF=?mode=album&album=" . urlencode($fullname)
.
"&dispsize=$dispsize&start=$start&perpage=$perpage>$filename</a>\n";
--- index.phtml.orig Sun Jan 27 13:32:42 2002
+++ index.phtml Sat Feb 2 15:37:18 2002
@@ -4,6 +4,19 @@
$version = "2.0.2";
+if (is_numeric($perpage)) {
+ $items_per_page = $perpage;
+ if ($items_per_page > $items_per_page_max) {
+ $items_per_page = $items_per_page_max;
+ }
+ if ($items_per_page < $items_per_page_min) {
+ $items_per_page = $items_per_page_min;
+ }
+} else {
+ $items_per_page = $items_per_page_default;
+}
+$perpage = $items_per_page;
+
print "<HTML>\n";
print "<HEAD>\n";
if ($mode == "album" or $mode == "view") {
@@ -42,7 +55,7 @@
}
is_array($alblist) and sort($alblist);
for ($i = 0 ; $i < sizeof($alblist) ; $i++) {
-
print "<A HREF=?mode=album&album=" . urlencode($alblist[$i])
. "&dispsize=$dispsize>";
+
print "<A HREF=?mode=album&album=" . urlencode($alblist[$i])
. "&dispsize=$dispsize&perpage=$perpage>";
@@ -84,7 +97,7 @@
-
print "<td align=center><A
HREF=?mode=album&album=".urlencode("$album/$dirname") . ">";
+
print "<td align=center><A
HREF=?mode=album&album=".urlencode("$album/$dirname") .
"&perpage=$perpage>";
$imgbase . "/blank.gif\&quot;></td>\n";
@@ -97,7 +110,7 @@
-
print "<td><A HREF=?mode=album&album=$album/$file>";
+
print "<td><A
HREF=?mode=album&album=$album/$file&perpage=$perpage>";
@@ -115,7 +128,7 @@
-
print "<td align=center><A
HREF=?mode=view&album=".urlencode($album)."&pic=".urlencode($file)."&dispsize=$dispsize&start=$start>";
+
print "<td align=center><A
HREF=?mode=view&album=".urlencode($album)."&pic=".urlencode($file)."&dispsize=$dispsize&start=$start&perpage=$perpage>";
$imgbase . "$imgsrc\&quot;><br>$file\n";
@@ -126,7 +139,7 @@
}
print "</tr>\n";
print "<tr bgcolor=white><td colspan=$display_cols><table
border=0 width=100%><tr><td>";
-
print "<A HREF=?mode=album&album=" . urlencode($album) .
"&start=0>Start</a> | ";
+
print "<A HREF=?mode=album&album=" . urlencode($album) .
"&start=0&perpage=$perpage>Start</a> | ";
if ($start > 0) {
"&start=";
@@ -134,15 +147,26 @@
-
print ">Prev $items_per_page</a> | ";
+
print "&perpage=$perpage>Prev $items_per_page</a> | ";
} else {
-
print "<A HREF=?mode=album&album=" . urlencode($album) .
"&start=$x>Next $items_per_page</a> | ";
+
print "<A HREF=?mode=album&album=" . urlencode($album) .
"&start=$x&perpage=$perpage>Next $items_per_page</a> | ";
} else {
+
print "<FORM>\n";
+
while (list($key, $val) = each($HTTP_GET_VARS)) {
+
print "<input type=hidden name=\&quot;$key\&quot; value=\&quot;$val\&quot;>\n";
+
}
+
print "<SELECT name=perpage>\n";
+
for ($i = $items_per_page_min; $i <= $items_per_page_max;
$i++) {
+
print "<OPTION value=\&quot;$i\&quot;". ($i == $items_per_page ? "
selected" : "") . ">$i</OPTION>\n";
+
}
+
print "</SELECT>\n";
+
print "Pics per page<input type=submit value=change>";
+
print "</FORM>\n";
print "</td><td align=right>";
if ($totalfiles > 0) {
@@ -217,7 +241,7 @@
/',"%20","/$dyn_base/$album/$thumbpic");
-
print "<A
HREF=?mode=view&album=".urlencode($album)."&pic=".urlencode($prevfile)."&dispsize=$dlinksize&start=$start>";
+
print "<A
HREF=?mode=view&album=".urlencode($album)."&pic=".urlencode($prevfile)."&dispsize=$dlinksize&start=$start&perpage=$perpage>";
$thumbsize[3] BORDER=0 SRC=\&quot;" . $imgbase . "$imgsrc\&quot;></a>";
} else {
. "/blank.gif\&quot;></td>\n";
@@ -265,7 +289,7 @@
/',"%20","/$dyn_base/$album/$thumbpic");
-
print "<A
HREF=?mode=view&album=".urlencode($album)."&pic=".urlencode($nextfile)."&dispsize=$dlinksize&start=$start>";
+
print "<A
HREF=?mode=view&album=".urlencode($album)."&pic=".urlencode($nextfile)."&dispsize=$dlinksize&start=$start&perpage=$perpage>";
BORDER=0 SRC=\&quot;" . $imgbase . "$imgsrc\&quot;></a>";
} else {
@@ -273,9 +297,9 @@
}
-
#print "<A HREF=convert.phtml?effect=charcoal&file=" .
urlencode($viewfile) . ">Charcoal</a>\n";
-
#print " | <A HREF=convert.phtml?effect=paint&file=" .
urlencode($viewfile) . ">Paint</a>\n";
-
#print " | <A HREF=convert.phtml?effect=shade&file=" .
urlencode($viewfile) . ">Shade</a>\n";
+
#print "<A HREF=convert.phtml?effect=charcoal&file=" .
urlencode($viewfile) . "&perpage=$perpage>Charcoal</a>\n";
+
#print " | <A HREF=convert.phtml?effect=paint&file=" .
urlencode($viewfile) . "&perpage=$perpage>Paint</a>\n";
+
#print " | <A HREF=convert.phtml?effect=shade&file=" .
urlencode($viewfile) . "&perpage=$perpage>Shade</a>\n";
#print "<br>\n";
print "</td></tr></table></td></tr>\n";
#if ($show_exif) {
--- config.inc.orig Sun Jan 27 14:06:28 2002
+++ config.inc Sun Jan 27 14:11:57 2002
@@ -11,7 +11,9 @@
$sitehome
= "http://phpix.org";
## EXIF Support requires PHP4 with exif support compiled
$show_exif
= 0;
-$items_per_page
= 6;
+$items_per_page_default
= 6;
+$items_per_page_min = 3;
+$items_per_page_max = 21;
$display_cols = 4;
$default_size = 640;
$thumb_size
= 120;
Logged In: YES
user_id=447148
OK that was ugly... so here it is in the form of a URL =)
<A
href="http://www.bsdchicks.com/perpage.patch">http://www.bsdchicks.com/perpage.patch</a>
Logged In: YES
user_id=10577
You can also attach the patch as a file... look at the
bottom of this page.
Much easier to download/keep track of.