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>
This commit is contained in:
Loui Chang 2009-01-19 15:24:35 -05:00
parent 2383f7dc06
commit 384f1ba3c9

View file

@ -124,34 +124,40 @@ 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></td></tr> </span></span></td></tr>
</tr> </tr>
<?php
if ($_GET['PP'] > 0) {
$pages = ceil($total / $_GET['PP']);
}
if ($pages > 1) {
?>
<tr> <tr>
<td align='left' width='25%'> <td align='center' width='100%'>
<?php if (($_GET['O'] - $_GET['PP']) >= 0): ?> <?php
<a href="packages.php?<?php print mkurl('O=' . ($_GET['O'] - $_GET['PP'])) ?>"><?php print __("Less") ?></a> if ($_GET['O'] > 0) {
<?php elseif ($_GET['O']<$_GET['PP'] && $_GET['O']>0): ?> $currentpage = ceil(($_GET['O'] + 1) / $_GET['PP']);
<a href="packages.php?<?php print mkurl('O=0') ?>"><?php print __("Less") ?></a> }
<?php endif; ?> else {
</td> $currentpage = 1;
<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']); } for ($i = 1; $i <= $pages; $i++) {
else { $currentpage = 1; } ?> if ($i <> $currentpage) :
<?php for ($i = 1; $i <= $pages; $i++) : $pagestart = ($i - 1) * $_GET['PP'];
if ($i <> $currentpage) : ?>
$pagestart = ($i-1)*$_GET['PP']; ?> <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 "[$i] ";
<?php else : print "[$i] "; endif;
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> </td>
</tr> </tr>
<?php } ?> <?php
}
}
?>
</table> </table>
</td> </td>