forked from sklover/Karl-Vs-Zombies
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpagination.php
More file actions
40 lines (31 loc) · 1.03 KB
/
pagination.php
File metadata and controls
40 lines (31 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<div class="pagination">
<?php if($page > 0): ?>
<?php print $pages; ?> Pages
<?php endif; ?>
<?php if($page > 0): ?>
<?php if($page > 1): ?>
<a href="javascript:goTo(1);">first</a>
<a href="javascript:goTo(<?php print ($page - 1); ?>);"><</a>
<?php endif; ?>
<?php
$prev_start = (($page - 2) >= 1) ? $page - 2 : 1;
?>
<?php for($i = $prev_start; $i < $page; $i++): ?>
<a href="javascript:goTo(<?php print $i; ?>);"><?php print $i; ?></a>
<?php endfor; ?>
<strong class="current"><?php print $page; ?></strong>
<?php
$next_start = (($page + 2) <= $pages) ? $page + 2 : $pages;
?>
<?php for($i = ($page + 1); $i <= $next_start; $i++): ?>
<a href="javascript:goTo(<?php print $i; ?>);"><?php print $i; ?></a>
<?php endfor; ?>
<?php if($page < $pages): ?>
<a href="javascript:goTo(<?php print ($page + 1); ?>);">></a>
<a href="javascript:goTo(<?php print $pages; ?>);">last</a>
<?php endif; ?>
<?php endif; ?>
<?php if($page > 0): ?>
<strong><?php print $count; ?></strong> Players
<?php endif; ?>
</div>