Location: PHPKode > scripts > Page Navigator > page-navigator/example_use.php
<?php

/*
 ______________________________________________________
/¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯\
|         Class Page Navigator by Efots     |
|                                                      |
|   Feel free to copy, use and change this script as   |
|   long as this part remains unchanged.               |
|                                                      |
|   If you have any questions and or comments please   |
|   E-mail me :                                        |
|				- 'hide@address.com'          				 |
|                                                      |
\______________________________________________________/
 ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
*/

/* You can create one, two or more page navigator */

require_once('class.paging.php');

/*This is the first page navigator*/
//PAGE NAVIGATOR----------------------------------

//Set the first page navigator identified by zero point
$nPageNav = 0;

//Set the "current row number", if from the querystring is none then put zero for the first time
$crn0 = (isset($_GET['crn0']) && !empty($_GET['crn0'])) ? $_GET['crn0'] : 0; 

//Set the "current group row number", if from the querystring is none then put zero for the first time
$cgrn0 = (isset($_GET['cgrn0']) && !empty($_GET['cgrn0'])) ? $_GET['cgrn0'] : 0;

//Set the max of number data per page
$mrn0 = 10;

//Set the max of number group data per page
$mgrn0 = 10;
//----------------------

/*-----------------------*/
/* YOUR DATA LOAD HERE */
/*-----------------------*/

//PAGE NAVIGATOR------------------------------------------
/*Set the number data that would be displayed. it's usualy if you load the data from MySQL or another,
	then you might put the result from num_row function*/
$record_number = $num_record;

/*Set the extra querystring argument that your current web page has.
	So if the number of page is clicked, the previous querystring would'nt dissapear.*/
$extArg = '';

//Now start to load the number of page
if ($record_number > 0) {
	$page = new Paging($nPageNav, $record_number, $cgrn0, $mgrn0, $crn0, $mrn0, $extArg);
	$page_array = $page->getPagingArray();
	$page_num = '<b>'.$page_array['lower'].'</b> - <b>'.$page_array['upper'].'</b> from <b>'.$page_array['total'].' ::</b> '.$page_array['previous_group'].' ';
	$page_number = $page->getPagingRowArray();
	while (list($key, $val) = each ($page_number)) {
		$page_num .= '[ '.$val.' ]';
	}
	$page_num .= ' '.$page_array['next_group'];
}else{
	$page_num ='&nbsp;';
}

echo $page_num;

//----------------------
/*End of first page navigator*/


//----------------------------------------------------------------------------------------------------


/*This is the second page navigator*/
//PAGE NAVIGATOR----------------------------------

//Set the second page navigator identified by zero point
$nPageNav = 1;

//Set the "current row number", if from the querystring is none then put zero for the first time
$crn1 = (isset($_GET['crn1']) && !empty($_GET['crn1'])) ? $_GET['crn1'] : 0; 

//Set the "current group row number", if from the querystring is none then put zero for the first time
$cgrn1 = (isset($_GET['cgrn1']) && !empty($_GET['cgrn1'])) ? $_GET['cgrn1'] : 0;

//Set the max of number data per page
$mrn1 = 10;

//Set the max of number group data per page
$mgrn1 = 10;
//----------------------

/*-----------------------*/
/* YOUR DATA LOAD HERE */
/*-----------------------*/

//PAGE NAVIGATOR------------------------------------------
/*Set the number data that would be displayed. it's usualy if you load the data from MySQL or another,
	then you might put the result from num_row function*/
$record_number = $num_record;

/*Set the extra querystring argument that your current web page has.
	So if the number of page is clicked, the previous querystring would'nt dissapear.*/
$extArg = '';

//Now start to load the number of page
if ($record_number > 0) {
	$page = new Paging($nPageNav, $record_number, $cgrn1, $mgrn1, $crn1, $mrn1, $extArg);
	$page_array = $page->getPagingArray();
	$page_num = '<b>'.$page_array['lower'].'</b> - <b>'.$page_array['upper'].'</b> from <b>'.$page_array['total'].' ::</b> '.$page_array['previous_group'].' ';
	$page_number = $page->getPagingRowArray();
	while (list($key, $val) = each ($page_number)) {
		$page_num .= '[ '.$val.' ]';
	}
	$page_num .= ' '.$page_array['next_group'];
}else{
	$page_num ='&nbsp;';
}

echo $page_num;

//----------------------
/*End of second page navigator*/

?>
Return current item: Page Navigator