Archived
1
0
This repository has been archived on 2020-12-10. You can view files and clone it, but cannot push or open issues or pull requests.
old/application/views/blog/pagination.php

38 lines
982 B
PHP
Raw Permalink Normal View History

2018-10-16 16:28:42 +00:00
<?php
2019-01-05 16:14:22 +00:00
defined('BASEPATH') OR exit('No direct script access allowed');
2018-10-16 16:28:42 +00:00
?>
<script>
2019-01-05 16:19:15 +00:00
$(() => {
const queries = parseQueryString();
if(!queries.page) {
window.location.search = '?page=1';
}
});
2019-01-05 16:14:22 +00:00
const pages = Math.ceil(parseFloat(<?= $pageCount ?>));
$('.pagination').twbsPagination({
2018-10-16 16:28:42 +00:00
visiblePages: 10,
2019-01-05 16:14:22 +00:00
totalPages: pages,
first: '<i class="fa fa-angle-double-left"></i>',
prev: '<i class="fa fa-angle-left"></i>',
next: '<i class="fa fa-angle-right"></i>',
last: '<i class="fa fa-angle-double-right"></i>',
href: true,
pageVariable: 'page',
2018-10-16 16:28:42 +00:00
});
2019-01-05 16:14:22 +00:00
function parseQueryString() {
let str = window.location.search;
const objURL = {};
str.replace(
new RegExp("([^?=&]+)(=([^&]*))?", "g"),
function ($0, $1, $2, $3) {
objURL[$1] = $3;
}
);
return objURL;
}
2018-10-16 16:28:42 +00:00
</script>