forked from jasongrimes/php-paginator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pagerSmall.phtml
49 lines (45 loc) · 2.04 KB
/
pagerSmall.phtml
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
41
42
43
44
45
46
47
48
<?php if ($paginator->getNumPages() > 1): ?>
<div class="input-group" style="width: 1px;">
<?php if ($paginator->getPrevUrl()): ?>
<span class="input-group-btn">
<a href="<?php echo $paginator->getPrevUrl(); ?>" class="btn btn-default" type="button">« Prev</a>
</span>
<?php endif; ?>
<select class="form-control paginator-select-page" style="width: auto; cursor: pointer; -webkit-appearance: none; -moz-appearance: none; appearance: none;">
<?php foreach ($paginator->getPages() as $page): ?>
<?php if ($page['url']): ?>
<option value="<?php echo $page['url']; ?>"<?php if ($page['isCurrent']) echo ' selected'; ?>>
Page <?php echo $page['num']; ?>
</option>
<?php else: ?>
<option disabled><?php echo $page['num']; ?></option>
<?php endif; ?>
<?php endforeach; ?>
</select>
<?php if ($paginator->getNextUrl()): ?>
<span class="input-group-btn">
<a href="<?php echo $paginator->getNextUrl(); ?>" class="btn btn-default" type="button">Next »</a>
</span>
<?php endif; ?>
</div>
<?php endif; ?>
<?php /* Depends on a little bit of javascript like this being included somewhere (this example requires jquery):
$(function() {
$('.paginator-select-page').on('change', function() {
document.location = $(this).val();
});
// Workaround to prevent iOS from zooming the page when clicking the select list:
$('.paginator-select-page')
.on('focus', function() {
if (/(iPad|iPhone|iPod)/g.test(navigator.userAgent)) {
$(this).css('font-size', '16px');
}
})
.on('blur', function() {
if (/(iPad|iPhone|iPod)/g.test(navigator.userAgent)) {
$(this).css('font-size', '');
}
})
;
});
*/ ?>