spqr/vendor/jasongrimes/paginator/examples/pagerSmall.phtml

50 lines
2.0 KiB
PHTML
Raw Normal View History

2024-11-05 12:10:06 +08:00
<?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">&laquo; 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 &raquo;</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', '');
}
})
;
});
*/ ?>