diff options
author | ben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-07-09 10:55:30 +0000 |
---|---|---|
committer | ben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-07-09 10:55:30 +0000 |
commit | 0a7233101a755bb1345006c54ac8e3d324651586 (patch) | |
tree | 2dd757682e7332fdbe4253c67dc9d5160666a499 /views | |
parent | a34ad594a15751bc06b76ac13ed8b4d2c03bfe04 (diff) | |
download | elgg-0a7233101a755bb1345006c54ac8e3d324651586.tar.gz elgg-0a7233101a755bb1345006c54ac8e3d324651586.tar.bz2 |
Further pagination change.
git-svn-id: https://code.elgg.org/elgg/trunk@1347 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'views')
-rw-r--r-- | views/default/navigation/pagination.php | 88 |
1 files changed, 46 insertions, 42 deletions
diff --git a/views/default/navigation/pagination.php b/views/default/navigation/pagination.php index 15fa63a67..0ce3b963a 100644 --- a/views/default/navigation/pagination.php +++ b/views/default/navigation/pagination.php @@ -70,52 +70,56 @@ }
- $currentpage = round($offset / $limit) + 1;
- $allpages = ceil($count / $limit);
-
- $i = 1;
- $pagesarray = array();
- while ($i <= $allpages && $i <= 3) {
- $pagesarray[] = $i;
- $i++;
- }
- $i = $currentpage - 1;
- while ($i <= $allpages && $i <= ($currentpage + 1)) {
- if ($i > 0 && !in_array($i,$pagesarray))
- $pagesarray[] = $i;
- $i++;
- }
- $i = $allpages - 2;
- while ($i <= $allpages) {
- if ($i > 0 && !in_array($i,$pagesarray))
+ if ($offset > 0 || $offset < ($count - $limit)) {
+
+ $currentpage = round($offset / $limit) + 1;
+ $allpages = ceil($count / $limit);
+
+ $i = 1;
+ $pagesarray = array();
+ while ($i <= $allpages && $i <= 3) {
$pagesarray[] = $i;
- $i++;
- }
-
- sort($pagesarray);
-
- $prev = 0;
- foreach($pagesarray as $i) {
-
- if (($i - $prev) > 1) {
-
- echo " ... ";
-
+ $i++;
}
-
- $counturl = $baseurl;
- $curoffset = (($i - 1) * $limit);
- if (substr_count($baseurl,'?')) {
- $counturl .= "&{$word}=" . $curoffset;
- } else {
- $counturl .= "?{$word}=" . $curoffset;
+ $i = $currentpage - 1;
+ while ($i <= $allpages && $i <= ($currentpage + 1)) {
+ if ($i > 0 && !in_array($i,$pagesarray))
+ $pagesarray[] = $i;
+ $i++;
}
- if ($curoffset != $offset) {
- echo " <a href=\"{$counturl}\">{$i}</a> ";
- } else {
- echo " {$i} ";
+ $i = $allpages - 2;
+ while ($i <= $allpages) {
+ if ($i > 0 && !in_array($i,$pagesarray))
+ $pagesarray[] = $i;
+ $i++;
+ }
+
+ sort($pagesarray);
+
+ $prev = 0;
+ foreach($pagesarray as $i) {
+
+ if (($i - $prev) > 1) {
+
+ echo " ... ";
+
+ }
+
+ $counturl = $baseurl;
+ $curoffset = (($i - 1) * $limit);
+ if (substr_count($baseurl,'?')) {
+ $counturl .= "&{$word}=" . $curoffset;
+ } else {
+ $counturl .= "?{$word}=" . $curoffset;
+ }
+ if ($curoffset != $offset) {
+ echo " <a href=\"{$counturl}\">{$i}</a> ";
+ } else {
+ echo " {$i} ";
+ }
+ $prev = $i;
+
}
- $prev = $i;
}
|