From 8d31fb8a50398458c260991f66298636307bd8b1 Mon Sep 17 00:00:00 2001 From: Loui Chang Date: Sat, 24 Jan 2009 13:10:16 -0500 Subject: Indicate when there are more search result pages than numbered links show. Signed-off-by: Loui Chang --- web/template/pkg_search_results.php | 49 +++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 24 deletions(-) (limited to 'web') diff --git a/web/template/pkg_search_results.php b/web/template/pkg_search_results.php index 5688b0b..71b6a63 100644 --- a/web/template/pkg_search_results.php +++ b/web/template/pkg_search_results.php @@ -15,6 +15,7 @@   + '> @@ -27,6 +28,7 @@ '> + @@ -50,19 +52,19 @@ for ($i = 0; $row = mysql_fetch_assoc($result); $i++) { -     + -    + -   + -    + -   + @@ -109,7 +111,8 @@ for ($i = 0; $row = mysql_fetch_assoc($result); $i++) { - + +
@@ -119,9 +122,6 @@ for ($i = 0; $row = mysql_fetch_assoc($result); $i++) { } if ($pages > 1) { - ?> - - 0) { $currentpage = ceil(($_GET['O'] + 1) / $_GET['PP']); } @@ -129,12 +129,10 @@ for ($i = 0; $row = mysql_fetch_assoc($result); $i++) { $currentpage = 1; } - if ($currentpage + 5 < $pages) { - $pages = $currentpage + 5; - } + $morepages = $currentpage + 5; # Display links for more search results. - for ($i = ($currentpage - 5); $i <= ($pages); $i++) { + for ($i = ($currentpage - 5); $i <= $morepages && $i <= $pages; $i++) { if ($i < 1) { $i = 1; } @@ -144,28 +142,31 @@ for ($i = 0; $row = mysql_fetch_assoc($result); $i++) { if ($i <> $currentpage) : ?> - [$i] "; endif; } - ?> - 0): - $O = $_GET['O'] - $_GET['PP']; - - if ($_GET['O'] < $_GET['PP']) { - $O = 0; + # Indicate that there are more pages. + if ($pages > $morepages) { + echo "... '; } + + if ($_GET['O'] > 0): + $O = $_GET['O'] - $_GET['PP']; + + if ($_GET['O'] < $_GET['PP']) { + $O = 0; + } ?> "> - + 0): ?> '> - - + +