diff options
author | Dries Buytaert <dries@buytaert.net> | 2003-03-12 20:45:24 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2003-03-12 20:45:24 +0000 |
commit | 53321bafae2836291cb9f15c7ac0fd268a71b734 (patch) | |
tree | 3a479269d24296cd008aa245328fbb22dec6d1de | |
parent | 4c7bd41a748494c20509b562acb27920a8d71ca5 (diff) | |
download | brdo-53321bafae2836291cb9f15c7ac0fd268a71b734.tar.gz brdo-53321bafae2836291cb9f15c7ac0fd268a71b734.tar.bz2 |
- Patch by Kjartan:
+ Pager is not generated when there are less results than the limit.
+ Fixes ugly blank rows in administration pages when there is just one
page.
-rw-r--r-- | includes/pager.inc | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/includes/pager.inc b/includes/pager.inc index abdfd9e95..6f5a38773 100644 --- a/includes/pager.inc +++ b/includes/pager.inc @@ -29,15 +29,18 @@ function pager_display($tags = "", $limit = 10, $element = 0, $type = "default", * @see pager_display */ function pager_display_default($tags = "", $limit = 10, $element = 0, $attributes = array()) { - $output .= "<div align=\"center\"><table cellpadding=\"10\"><tbody><tr>"; - $output .= "<td align=\"center\">". pager_first(($tags[0] ? $tags[0] : t("first page")), $limit, $element, $attributes) ."</td>"; - $output .= "<td align=\"center\">". pager_previous(($tags[1] ? $tags[1] : t("previous page")), $limit, $element, 1, $attributes) ."</td>"; - $output .= "<td align=\"center\">". pager_list($limit, $element, ($tags[2] ? $tags[2] : 9 ), "", $attributes) ."</td>"; - $output .= "<td align=\"center\">". pager_next(($tags[3] ? $tags[3] : t("next page")), $limit, $element, 1, $attributes) ."</td>"; - $output .= "<td align=\"center\">". pager_last(($tags[4] ? $tags[4] : t("last page")), $limit, $element, $attributes) ."</td>"; - $output .= "</tr></tbody></table></div>"; - - return "$output"; + global $pager_total; + if ($pager_total[$element] > $limit) { + $output .= "<div align=\"center\"><table cellpadding=\"10\"><tbody><tr>"; + $output .= "<td align=\"center\">". pager_first(($tags[0] ? $tags[0] : t("first page")), $limit, $element, $attributes) ."</td>"; + $output .= "<td align=\"center\">". pager_previous(($tags[1] ? $tags[1] : t("previous page")), $limit, $element, 1, $attributes) ."</td>"; + $output .= "<td align=\"center\">". pager_list($limit, $element, ($tags[2] ? $tags[2] : 9 ), "", $attributes) ."</td>"; + $output .= "<td align=\"center\">". pager_next(($tags[3] ? $tags[3] : t("next page")), $limit, $element, 1, $attributes) ."</td>"; + $output .= "<td align=\"center\">". pager_last(($tags[4] ? $tags[4] : t("last page")), $limit, $element, $attributes) ."</td>"; + $output .= "</tr></tbody></table></div>"; + + return $output; + } } /** |