[aur-dev] [PATCH] Change how pagination looks, add start and end buttons

Callan Barrett wizzomafizzo at gmail.com
Fri Jan 30 13:39:47 EST 2009


Got rid of the links in elipsis, added elips to start, changed next and prev buttons to > and <, added begin and end buttons

Signed-off-by: Callan Barrett <wizzomafizzo at gmail.com>
---
 web/template/pkg_search_results.php |   39 ++++++++++++++++++++--------------
 1 files changed, 23 insertions(+), 16 deletions(-)

diff --git a/web/template/pkg_search_results.php b/web/template/pkg_search_results.php
index 71b6a63..ba0398c 100644
--- a/web/template/pkg_search_results.php
+++ b/web/template/pkg_search_results.php
@@ -116,6 +116,20 @@ for ($i = 0; $row = mysql_fetch_assoc($result); $i++) {
 		<?php print __("Showing results %s - %s of %s", $first, $last, $total) ?>
 		</span></span>
 		<br />
+
+		<?php if ($_GET['O'] != 0): ?><a href="packages.php?<?php print mkurl("O=0") ?>"><?php echo '&lt;&lt;' ?></a><?php endif; ?>
+
+		<?php
+			if ($_GET['O'] > 0):
+				$O = $_GET['O'] - $_GET['PP'];
+
+				if ($_GET['O'] < $_GET['PP']) {
+					$O = 0;
+				}
+		?>
+			<a href="packages.php?<?php print mkurl("O=$O") ?>"><?php echo '&lt;' ?></a>
+		<?php   endif; ?>
+
 			<?php
 			if ($_GET['PP'] > 0) {
 				$pages = ceil($total / $_GET['PP']);
@@ -131,6 +145,8 @@ for ($i = 0; $row = mysql_fetch_assoc($result); $i++) {
 
 				$morepages = $currentpage + 5;
 
+				print (($currentpage-5) > 1) ? '...' : '';
+
 				# Display links for more search results.
 				for ($i = ($currentpage - 5); $i <= $morepages && $i <= $pages; $i++) {
 					if ($i < 1) {
@@ -141,30 +157,21 @@ for ($i = 0; $row = mysql_fetch_assoc($result); $i++) {
 
 					if ($i <> $currentpage) :
 					?>
-				<a href='packages.php?<?php print mkurl('O=' . ($pagestart))?>'><?php print "$i " ?></a>
+				<a href='packages.php?<?php print mkurl('O=' . ($pagestart))?>'><?php print "$i" ?></a>
 					<?php else : print "<b>[$i] </b>";
 					endif;
 				}
 
-				# Indicate that there are more pages.
-				if ($pages > $morepages) {
-					echo "<a href=\"packages.php?" . mkurl('O=' . ($pagestart + $_GET['PP'])) . '">... </a>';
-				}
+                                print ($pages > $morepages) ? '...' : '';
 
-				if ($_GET['O'] > 0):
-					$O = $_GET['O'] - $_GET['PP'];
+                                ?>
 
-					if ($_GET['O'] < $_GET['PP']) {
-						$O = 0;
-					}
-			?>
-				<a href="packages.php?<?php print mkurl("O=$O") ?>"><?php echo __('Previous') ?></a>
-			<?php   endif; ?>
-
-			<?php if ($total - $_GET['PP'] - $_GET['O'] > 0): ?>
-				<a href='packages.php?<?php print mkurl('O=' . ($_GET['O'] + $_GET['PP'])) ?>'><?php echo __('Next') ?></a>
+            		<?php if ($total - $_GET['PP'] - $_GET['O'] > 0): ?>
+				<a href='packages.php?<?php print mkurl('O=' . ($_GET['O'] + $_GET['PP'])) ?>'><?php echo '&gt;' ?></a>
 			<?php endif; ?>
 
+                        <?php if ($_GET['O'] < ($total-$_GET['PP'])): ?><a href="packages.php?<?php print mkurl("O=" . ($total-$_GET['PP'])) ?>"><?php echo '&gt;&gt;' ?></a><?php endif; ?>
+
 		</td>
 	</tr>
 
-- 
1.6.0.4



More information about the aur-dev mailing list