PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Developer CK   PHP AJAX Paging Class   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: implementation
Class: PHP AJAX Paging Class
Display pagination links updated using AJAX
Author: By
Last change:
Date: 9 years ago
Size: 2,404 bytes


Class file image Download
 * @version 1.0
 * @author CK
 * @date 22-Feb-2013
 * @desc this javascript function is used to show a dynamic list has paging.
 * e.g: You have a list of 100 record and you fetch that through
 * ajax but now you want to show these records by paging
div.pagination {
    padding: 3px;
    margin: 3px;

div.pagination a {
    padding: 2px 5px 2px 5px;
    margin: 2px;
    border: 1px solid #AAAADD;
    text-decoration: none; /* no underline */
    color: #000099;

div.pagination a:hover,div.pagination a:active {
    border: 1px solid #000099;
    color: #000;

div.pagination span.current {
    padding: 2px 5px 2px 5px;
    margin: 2px;
    border: 1px solid #1A3C7D;
    font-weight: bold;
    background: none repeat scroll 0 0 #446DBD;
    color: #FFF;

div.pagination span.disabled {
    padding: 2px 5px 2px 5px;
    margin: 2px;
    border: 1px solid #EEE;
    color: #DDD;
// code used in ajax php File |
//page is parameter to get current page No
if(isset($_REQUEST['page'])and $_REQUEST['page']<>''){
$pageNo = $_REQUEST['page'];
$_REQUEST['extraParam'])and $_REQUEST['extraParam']<>''){

//write this code where you are fetching the result by query
//$pagename Pass the ajax file path
//$div Pass the div name where result will be displayed
//$extraParam if You Wish then pass extra parameter to ajax php file
//$pageNo pass current Pageno

$paging_obj = new AjaxPagingManager($pageName,$divid ,$extraParam='', $pageNo);

$offsetLimit =$paging_obj->getOffset(); // this function will provide starting limit used in sql query
$endLimit=$paging_obj->getStart();// this function will provide end limit used in sql query to fetch record
 * perform your query here and get result
//================pass the total result of query to get Paging String

$pagingStr = $paging_obj->doPaging($totalRecords);
//----------print this paging String to get Paging

//=============printing paging string like this

<table >
             <td class="pagestring"><?php print $pagingStr; ?> </td>