Login   Register  
PHP Classes
elePHPant
Icontem

File: refresher.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Jannerel Roche  >  Paging Class with AJAX or HREF  >  refresher.php  >  Download  
File: refresher.php
Role: Example script
Content type: text/plain
Description: second file
Class: Paging Class with AJAX or HREF
Browse paginated query results using AJAX or HREF
Author: By
Last change: -removed redundant aruments to function calls
-added grouping of pagers
-added sorting by field
-cleaned up code a bit
Date: 2010-10-26 07:17
Size: 2,258 bytes
 

Contents

Class file image Download
<?
    
/*
     * This file is to be included from the main index file for ajax call. 
     * -When you want to use ajax instead of a simple HREF Tag, 
     * please comment linkAsAjax() line 
    */

    /* please find your own files and update the require paths below...
     * 
     * */

    /*
     * additions and revisions:
     * added ASCENDING/DESCENDING by field columns using: $newPaging->useOrdering($v) please see line 69
     * added grouping the pagers to limit the pagers in your page (please see the ellipses on line 54)
     * 
     * */


require_once 'config/config.php';
require_once 
'lib/corephp/class.database.php';
require_once 
'lib/corephp/Paging.php';


$db = new Database();



$pagespergroup 5$limitpp 10$spacer ' | ';

//no need to edit anything beyond this line except for all query variables:
//change $query, $orderby to reflect your own; change $fetchnow->DESCRIPTION to suite your own column name from you own database

 


$query "SELECT TABLE_NAME, COLUMN_NAME FROM columns";


$newPaging = new Paging($query$_REQUEST$limitpp$pagespergroup);
$newPaging->linkAsAjax('post''container''refresher.php');
$f $newPaging->getFields
$res $newPaging->showPageRecs(); 





echo 
$newPaging->fullquery."<br/>";
echo 
"mul: ".$mul."<br/>startat: ".$startat."<br/><br/>";


echo 
$newPaging->showFirst('&laquo;')."&nbsp;".
     
$newPaging->showPrevGroup(' (...) ').
     
$newPaging->showPrev('prev')."&nbsp;".
     
$newPaging->showPages($spacer)."&nbsp;".
     
$newPaging->showNext('next')."&nbsp;".
     
$newPaging->showNextGroup(' (...) ').
     
$newPaging->showLast('&raquo;');
     


echo 
"<BR><BR>";



echo 
"<table border='1' width=500>";
echo 
"<tr>";
foreach(
$f as $k=>$v){ echo "<td>".$newPaging->useOrdering($v).'</td>';}
echo 
"</tr>";

while (
$row mysql_fetch_object($res)) {
    echo 
"<tr><td>".$row->TABLE_NAME"</td><Td>"$row->COLUMN_NAME."</td></tr>";
    
}

echo 
"</table><BR><BR>";

//showFirst, showPrev, showNext, showLast, showPages are optional functions
echo $newPaging->showFirst('&laquo;')."&nbsp;".
     
$newPaging->showPrev('prev')."&nbsp;".
     
$newPaging->showPages($spacer)."&nbsp;".
     
$newPaging->showNext('next')."&nbsp;".
     
$newPaging->showLast('&raquo;');

?>