Commit 5702137e authored by Callan Barrett's avatar Callan Barrett Committed by Loui Chang
Browse files

Change pagination style



Looks different now, next and previous on their own sides and elips for both
Signed-off-by: default avatarCallan Barrett <wizzomafizzo@gmail.com>
Signed-off-by: default avatarLoui Chang <louipc.ist@gmail.com>
parent 9afe1eee
...@@ -451,3 +451,10 @@ textarea.vLargeTextField { ...@@ -451,3 +451,10 @@ textarea.vLargeTextField {
text-decoration: none; text-decoration: none;
} }
#pages { margin: 5px; }
#pages .page_num {
border: 1px solid #ddd;
padding: 2px;
color: #0771a6;
}
#pages #page_sel { color: #555; }
...@@ -116,6 +116,19 @@ for ($i = 0; $row = mysql_fetch_assoc($result); $i++) { ...@@ -116,6 +116,19 @@ for ($i = 0; $row = mysql_fetch_assoc($result); $i++) {
<?php print __("Showing results %s - %s of %s", $first, $last, $total) ?> <?php print __("Showing results %s - %s of %s", $first, $last, $total) ?>
</span></span> </span></span>
<br /> <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 '&lt; ' . __('Previous') ?></a>
<?php endif; ?>
<?php <?php
if ($_GET['PP'] > 0) { if ($_GET['PP'] > 0) {
$pages = ceil($total / $_GET['PP']); $pages = ceil($total / $_GET['PP']);
...@@ -131,6 +144,8 @@ for ($i = 0; $row = mysql_fetch_assoc($result); $i++) { ...@@ -131,6 +144,8 @@ for ($i = 0; $row = mysql_fetch_assoc($result); $i++) {
$morepages = $currentpage + 5; $morepages = $currentpage + 5;
print (($currentpage-5) > 1) ? '...' : '';
# Display links for more search results. # Display links for more search results.
for ($i = ($currentpage - 5); $i <= $morepages && $i <= $pages; $i++) { for ($i = ($currentpage - 5); $i <= $morepages && $i <= $pages; $i++) {
if ($i < 1) { if ($i < 1) {
...@@ -141,30 +156,21 @@ for ($i = 0; $row = mysql_fetch_assoc($result); $i++) { ...@@ -141,30 +156,21 @@ for ($i = 0; $row = mysql_fetch_assoc($result); $i++) {
if ($i <> $currentpage) : 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))?>'><span class="page_num"><?php print "$i" ?></span></a>
<?php else : print "<b>[$i] </b>"; <?php else : print '<span class="page_sel"><b>'.$i.'</b></span> ';
endif; endif;
} }
# Indicate that there are more pages. print ($pages > $morepages) ? '...' : '';
if ($pages > $morepages) {
echo "<a href=\"packages.php?" . mkurl('O=' . ($pagestart + $_GET['PP'])) . '">... </a>';
}
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): ?> <?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') . ' &gt;' ?></a>
<?php endif; ?> <?php endif; ?>
</div>
</td> </td>
</tr> </tr>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment