diff options
author | Callan Barrett <wizzomafizzo@gmail.com> | 2009-02-02 09:54:49 +0100 |
---|---|---|
committer | Loui Chang <louipc.ist@gmail.com> | 2009-02-03 23:04:21 +0100 |
commit | 5702137e67d42520821c5c569473988f6862a7d9 (patch) | |
tree | 959c583d17fffe6cadd82ed668f0c13b860537a4 | |
parent | 9afe1eee46afc06e08c2fd7cba2cf7fae71ad0a6 (diff) | |
download | aur-5702137e67d42520821c5c569473988f6862a7d9.tar.gz aur-5702137e67d42520821c5c569473988f6862a7d9.tar.xz |
Change pagination style
Looks different now, next and previous on their own sides and elips for both
Signed-off-by: Callan Barrett <wizzomafizzo@gmail.com>
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
-rw-r--r-- | web/html/css/arch.css | 7 | ||||
-rw-r--r-- | web/template/pkg_search_results.php | 38 |
2 files changed, 29 insertions, 16 deletions
diff --git a/web/html/css/arch.css b/web/html/css/arch.css index da670eeb..80bbc924 100644 --- a/web/html/css/arch.css +++ b/web/html/css/arch.css @@ -451,3 +451,10 @@ textarea.vLargeTextField { text-decoration: none; } +#pages { margin: 5px; } +#pages .page_num { + border: 1px solid #ddd; + padding: 2px; + color: #0771a6; +} +#pages #page_sel { color: #555; } diff --git a/web/template/pkg_search_results.php b/web/template/pkg_search_results.php index 71b6a636..736823a7 100644 --- a/web/template/pkg_search_results.php +++ b/web/template/pkg_search_results.php @@ -116,6 +116,19 @@ for ($i = 0; $row = mysql_fetch_assoc($result); $i++) { <?php print __("Showing results %s - %s of %s", $first, $last, $total) ?> </span></span> <br /> + + <div id="pages"> + <?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 '< ' . __('Previous') ?></a> + <?php endif; ?> + <?php if ($_GET['PP'] > 0) { $pages = ceil($total / $_GET['PP']); @@ -131,6 +144,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 +156,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> - <?php else : print "<b>[$i] </b>"; + <a href='packages.php?<?php print mkurl('O=' . ($pagestart))?>'><span class="page_num"><?php print "$i" ?></span></a> + <?php else : print '<span class="page_sel"><b>'.$i.'</b></span> '; endif; } - # Indicate that there are more pages. - if ($pages > $morepages) { - echo "<a href=\"packages.php?" . mkurl('O=' . ($pagestart + $_GET['PP'])) . '">... </a>'; - } - - if ($_GET['O'] > 0): - $O = $_GET['O'] - $_GET['PP']; + print ($pages > $morepages) ? '...' : ''; - 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> + <a href='packages.php?<?php print mkurl('O=' . ($_GET['O'] + $_GET['PP'])) ?>'><?php echo __('Next') . ' >' ?></a> <?php endif; ?> + </div> + </td> </tr> |