From db1b03220d1d9eced86e6177f6787e59e5fd69a5 Mon Sep 17 00:00:00 2001 From: Arun Persaud Date: Thu, 24 Nov 2011 11:03:27 -0800 Subject: make index.php page aware; make default page start at 1 this way page=0 can be used for an overview --- getjson.php | 2 +- 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 = ""; diff --git a/index.php b/index.php index d3d569f..44be53b 100644 --- a/index.php +++ b/index.php @@ -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; + ?> <?php echo htmlspecialchars($title) ?> @@ -35,8 +42,8 @@ $N=$iniarray["pics_per_page"]; var pics = d3.select(".pics").append("ul"); -var page=0; -var N=; +var page=; +var 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);}; -- cgit v1.2.3-18-g5258