javascript - How to implement the simplepagination plugin that i'm using with php? -
javascript - How to implement the simplepagination plugin that i'm using with php? -
this html php code:
<?php $sql = mysqli_query($con, "select * blog_posts poststatus = 'accepted' order date_accepted desc"); while($row = mysqli_fetch_array($sql)) ?> <article> <?php echo $row['posttitle']." posted on ".date('js m y', strtotime($row['postdate']))." ".$row['postdesc']; ?> </article> <?php } } ?> <div id="selector"> <ul class="selector"> <li> <p>one</p> </li> <li> <p>two</p> </li> <li> <p>three</p> </li> <li> <p>four</p> </li> <li> <p>five</p> </li> <li> <p>six</p> </li> <li> <p>seven</p> </li> <li> <p>eight</p> </li> </ul> </div>
and javascript:
$(function() { $(selector).pagination({ items: 100, itemsonpage: 5, cssstyle: 'light-theme' });
});
i got plugin here: http://flaviusmatis.github.io/simplepagination.js/
what want know how utilize plugin php code. have 20 posts , want show 10 post. in advance!!
the "selector" here represents class, should using this[if want pagination "li"]:
$(function() { $('.selector').pagination({ items: 100, itemsonpage: 5, cssstyle: 'light-theme' }); });
or
the "selector" here represents id, should using this[if want pagination "div"]:
$(function() { $('#selector').pagination({ items: 100, itemsonpage: 5, cssstyle: 'light-theme' }); });
you can utilize 1 of method depending on want pagination implemented, whther on li or div.
to implement pagination on article,give article id or class , implement pagination. illustration lets article has id="pagin", respective pagination function should implemented like:
$(function() { $('#pagin').pagination({ items: 100, itemsonpage: 5, cssstyle: 'light-theme' }); });
javascript php jquery pagination
Comments
Post a Comment