summaryrefslogtreecommitdiffstats
path: root/web/template/pkg_search_results.php
diff options
context:
space:
mode:
authorLoui Chang <louipc.ist@gmail.com>2009-01-19 21:24:35 +0100
committerLoui Chang <louipc.ist@gmail.com>2009-01-19 21:28:10 +0100
commit384f1ba3c9bc94de61a515b0491960b34a1b74ae (patch)
tree2e51852129a08c257019cef73186d7c8b7bea1db /web/template/pkg_search_results.php
parent2383f7dc06e6ac03ed3caecc3f31ecad5ab087dd (diff)
downloadaur-384f1ba3c9bc94de61a515b0491960b34a1b74ae.tar.gz
aur-384f1ba3c9bc94de61a515b0491960b34a1b74ae.tar.xz
Remove Less and More links from search results page.
Don't show extra search results link if there is only one page of results. Fix indenting and coding style. Signed-off-by: Loui Chang <louipc.ist@gmail.com>
Diffstat (limited to 'web/template/pkg_search_results.php')
-rw-r--r--web/template/pkg_search_results.php54
1 files changed, 30 insertions, 24 deletions
diff --git a/web/template/pkg_search_results.php b/web/template/pkg_search_results.php
index cae0eb49..c098b286 100644
--- a/web/template/pkg_search_results.php
+++ b/web/template/pkg_search_results.php
@@ -124,34 +124,40 @@ for ($i = 0; $row = mysql_fetch_assoc($result); $i++) {
<?php print __("Showing results %s - %s of %s", $first, $last, $total) ?>
</span></span></td></tr>
</tr>
+ <?php
+ if ($_GET['PP'] > 0) {
+ $pages = ceil($total / $_GET['PP']);
+ }
+
+ if ($pages > 1) {
+ ?>
+
<tr>
- <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='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; ?>
+ <td align='center' width='100%'>
+ <?php
+ if ($_GET['O'] > 0) {
+ $currentpage = ceil(($_GET['O'] + 1) / $_GET['PP']);
+ }
+ else {
+ $currentpage = 1;
+ }
+
+ 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;
+ }
+ ?>
</td>
</tr>
-<?php } ?>
+<?php
+ }
+}
+?>
</table>
</td>