From 53321bafae2836291cb9f15c7ac0fd268a71b734 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Wed, 12 Mar 2003 20:45:24 +0000 Subject: - 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. --- includes/pager.inc | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'includes') 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 .= "
"; - $output .= ""; - $output .= ""; - $output .= ""; - $output .= ""; - $output .= ""; - $output .= "
". pager_first(($tags[0] ? $tags[0] : t("first page")), $limit, $element, $attributes) ."". pager_previous(($tags[1] ? $tags[1] : t("previous page")), $limit, $element, 1, $attributes) ."". pager_list($limit, $element, ($tags[2] ? $tags[2] : 9 ), "", $attributes) ."". pager_next(($tags[3] ? $tags[3] : t("next page")), $limit, $element, 1, $attributes) ."". pager_last(($tags[4] ? $tags[4] : t("last page")), $limit, $element, $attributes) ."
"; - - return "$output"; + global $pager_total; + if ($pager_total[$element] > $limit) { + $output .= "
"; + $output .= ""; + $output .= ""; + $output .= ""; + $output .= ""; + $output .= ""; + $output .= "
". pager_first(($tags[0] ? $tags[0] : t("first page")), $limit, $element, $attributes) ."". pager_previous(($tags[1] ? $tags[1] : t("previous page")), $limit, $element, 1, $attributes) ."". pager_list($limit, $element, ($tags[2] ? $tags[2] : 9 ), "", $attributes) ."". pager_next(($tags[3] ? $tags[3] : t("next page")), $limit, $element, 1, $attributes) ."". pager_last(($tags[4] ? $tags[4] : t("last page")), $limit, $element, $attributes) ."
"; + + return $output; + } } /** -- cgit v1.2.3