Archived
1
0

Fix blog pagination

This commit is contained in:
Marcel 2019-01-05 17:14:22 +01:00
parent 58035b085f
commit ebd1d4a227
2 changed files with 37 additions and 20 deletions

View File

@ -1,15 +1,32 @@
<?php <?php
defined('BASEPATH') OR exit('No direct script access allowed'); defined('BASEPATH') OR exit('No direct script access allowed');
?> ?>
<script> <script>
$('.page-selection').twbsPagination({ const pages = Math.ceil(parseFloat(<?= $pageCount ?>));
totalPages: <?= $pageCount; ?>, $('.pagination').twbsPagination({
visiblePages: 10, visiblePages: 10,
first: '<i class="fa fa-fast-backward"></i>', // prevText: '<span aria-hidden="true">&laquo;</span>',
prev: '<i class="fa fa-step-backward"></i>', // nextText: '<span aria-hidden="true">&raquo;</span>',
next: '<i class="fa fa-step-forward"></i>', totalPages: pages,
last: '<i class="fa fa-fast-forward"></i>', first: '<i class="fa fa-angle-double-left"></i>',
href: '?page={{number}}' 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',
}); });
function parseQueryString() {
let str = window.location.search;
const objURL = {};
str.replace(
new RegExp("([^?=&]+)(=([^&]*))?", "g"),
function ($0, $1, $2, $3) {
objURL[$1] = $3;
}
);
return objURL;
}
</script> </script>

View File

@ -1,17 +1,17 @@
<?php <?php
defined('BASEPATH') OR exit('No direct script access allowed'); defined('BASEPATH') OR exit('No direct script access allowed');
?> ?>
<div class="col-sm-8 col-sm-pull-4"> <div class="col-lg-8 order-lg-first">
<div class="blog"> <div class="blog">
<ul class="page-selection pagination-lg blog-pagination"></ul> <ul class="pagination pagination-lg justify-content-center"></ul>
<div id="content"> <div id="content">
<?php foreach($pageContent as $item) { <?php foreach ($pageContent as $item) {
$this->load->view('blog/postListEntry', $item); $this->load->view('blog/postListEntry', $item);
} ?> } ?>
</div>
<ul class="page-selection pagination-lg blog-pagination"></ul>
</div>
</div>
</div> </div>
<ul class="pagination pagination-lg justify-content-center"></ul>
</div> </div>
</div>
</div>
</div>
</section> </section>