Skip to main content

PHP Bootstrap Pagination

phpBootPagination is a utility script for implementing professional bootstrap compatible pagination in your php application by writing few lines of code.

Features

List of core features of php bootstrap pagination script.

  • Support both simple and complex pagination
  • Support jquery pagination.
  • Bootstrap 3.0 compatible user interface and links.
  • and more.

Example Code

Example 1: Simple Pagination Implementation.

include_once("pagination.php"); 
$pg = new bootPagination();
$pg->pagenumber = $pagenumber;
$pg->pagesize = $pagesize;
$pg->totalrecords = $totalrecords;
$pg->showfirst = true;
$pg->showlast = true;
$pg->paginationcss = "pagination-normal";
$pg->paginationstyle = 0; // 1: advance advance pagination, 0: normal pagination
$pg->defaultUrl = "index.php";
$pg->paginationUrl = "index.php?p=[p]";
echo $apagination->process();

Here is sample output

simple pagination screen 00
simple pagination screen 01
include_once("pagination.php"); 
$pg = new bootPagination();
$pg->pagenumber = $pagenumber;
$pg->pagesize = $pagesize;
$pg->totalrecords = $totalrecords;
$pg->showfirst = true;
$pg->showlast = true;
$pg->paginationcss = "pagination-normal";
$pg->paginationstyle = 1; // 1: advance advance pagination, 0: normal pagination
$pg->defaultUrl = "index.php";
$pg->paginationUrl = "index.php?p=[p]";
echo $apagination->process();

Here is sample output

simple pagination screen 00
simple pagination screen 01

Add compatibility with Jquery

<script type="text/javascript">
$(function () {
    $('.pglinks').on({
        click: function (e) {
       	 	ProcessPagination(this);
        	return false;
        }
    }, '.pagination-css');
});
function ProcessPagination(obj) {
    var id = $(obj).attr('id');
    if (id != undefined) {
    	var pid = null;
    if (id.indexOf("pl_") != -1) {
    	pid = id.replace("pl_", "");
    }
    else if (id.indexOf("pn_") != -1) {
    	pid = id.replace("pn_", "");
    }
    else if (id.indexOf("pg_") != -1) {
   	 	pid = id.replace("pg_", "");
    }
    else if (id.indexOf("pp_") != -1) {
    	pid = id.replace("pp_", "");
    }
    else if (id.indexOf("p_") != -1) {
    	pid = id.replace("p_", "");
    }
    	alert(pid + " linke selected");
    }
}
</script>