summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGergely Imreh <imrehg@gmail.com>2009-01-18 10:04:27 +0100
committerLoui Chang <louipc.ist@gmail.com>2009-01-19 20:39:21 +0100
commit0bdfe847e37d4d4faee03cc77253059d80a69e59 (patch)
tree4e61f34a837478e2762a2810cb9eed2b251b57fb
parent844de1f25b8080291fafca802b04ed61b9d17a4b (diff)
downloadaur-0bdfe847e37d4d4faee03cc77253059d80a69e59.tar.gz
aur-0bdfe847e37d4d4faee03cc77253059d80a69e59.tar.xz
Add: page numbering of AUR search results
On the search results page the number of pages is displayed and functions as a link, for faster navigation (not just the usual "Less/More" buttons. Signed-off-by: Loui Chang <louipc.ist@gmail.com>
-rw-r--r--web/template/pkg_search_results.php16
1 files changed, 14 insertions, 2 deletions
diff --git a/web/template/pkg_search_results.php b/web/template/pkg_search_results.php
index de77b91c..bf18e346 100644
--- a/web/template/pkg_search_results.php
+++ b/web/template/pkg_search_results.php
@@ -125,14 +125,26 @@ for ($i = 0; $row = mysql_fetch_assoc($result); $i++) {
</span></td>
</tr>
<tr>
- <td align='left'>
+ <td align='left' width='25%'>
<?php if (($_GET['O'] - $_GET['PP']) >= 0): ?>
<a href="packages.php?<?php print mkurl('O=' . ($_GET['O'] - $_GET['PP'])) ?>"><?php print __("Less") ?></a>
<?php elseif ($_GET['O']<$_GET['PP'] && $_GET['O']>0): ?>
<a href="packages.php?<?php print mkurl('O=0') ?>"><?php print __("Less") ?></a>
<?php endif; ?>
</td>
- <td align='right'>
+ <td align='center' width='50%'>
+ <?php if ($_GET['PP'] > 0) { $pages = ceil($total/$_GET['PP']); } ?>
+ <?php if ($_GET['O'] > 0) { $currentpage = ceil(($_GET['O']+1)/$_GET['PP']); }
+ else { $currentpage = 1; } ?>
+ <?php for ($i = 1; $i <= $pages; $i++) :
+ if ($i <> $currentpage) :
+ $pagestart = ($i-1)*$_GET['PP']; ?>
+ <a href='packages.php?<?php print mkurl('O=' . ($pagestart))?>'><?php print "$i" ?> </a>
+ <?php else : print "[$i] ";
+ endif;
+ endfor; ?>
+ </td>
+ <td align='right' width='25%'>
<?php if ($total - $_GET['PP'] - $_GET['O'] > 0): ?>
<a href='packages.php?<?php print mkurl('O=' . ($_GET['O'] + $_GET['PP'])) ?>'><?php print __("More") ?></a>
<?php endif; ?>