diff options
author | Arun Persaud <arun@nubati.net> | 2011-11-24 11:03:27 -0800 |
---|---|---|
committer | Arun Persaud <apersaud@lbl.gov> | 2011-11-24 11:03:27 -0800 |
commit | db1b03220d1d9eced86e6177f6787e59e5fd69a5 (patch) | |
tree | 39f0f133f0c7bd76a37a6c58619ecc4359d19021 | |
parent | 01394769937f108ee0f3a8077b34bb5fc9bffe24 (diff) | |
download | photo-tags-db1b03220d1d9eced86e6177f6787e59e5fd69a5.tar.gz photo-tags-db1b03220d1d9eced86e6177f6787e59e5fd69a5.tar.bz2 photo-tags-db1b03220d1d9eced86e6177f6787e59e5fd69a5.zip |
make index.php page aware; make default page start at 1
this way page=0 can be used for an overview
-rw-r--r-- | getjson.php | 2 | ||||
-rw-r--r-- | index.php | 15 |
2 files changed, 12 insertions, 5 deletions
diff --git a/getjson.php b/getjson.php index 24a913f..6026776 100644 --- a/getjson.php +++ b/getjson.php @@ -10,7 +10,7 @@ $N=$iniarray["pics_per_page"]; /* end parse ini-file */ if (isset($_REQUEST["P"])) - $OFFSET = "".($_REQUEST["P"]*$N).","; + $OFFSET = "".($_REQUEST["P"]*$N-$N).","; else $OFFSET = ""; @@ -7,6 +7,13 @@ $admin=$iniarray["admin"]; $title=$iniarray["title"]; $N=$iniarray["pics_per_page"]; /* end parse ini-file */ + +/* parse flags */ +if(isset($_REQUEST["page"])) + $page = intval($_REQUEST["page"]); +else + $page = 1; + ?> <html> <title><?php echo htmlspecialchars($title) ?></title> @@ -35,8 +42,8 @@ $N=$iniarray["pics_per_page"]; var pics = d3.select(".pics").append("ul"); -var page=0; -var N=<?php echo $N?>; +var page=<?php echo $page ?>; +var N=<?php echo $N ?>; var count=0; function myreload(a) { @@ -65,7 +72,7 @@ function myreload(a) { } function left() { - if (page>=1) page=page-1; + if (page>=2) page=page-1; myreload(page); } @@ -76,7 +83,7 @@ function right() { function checkbutton() { - if (page==0) + if (page==1) { d3.select("button.prev").attr("disabled","disabled");} else { d3.select("button.prev").attr("disabled", null);}; |