Location: PHPKode > scripts > Easy Pagination Array > example.php
/******
 * This example is a view in MVC
 * create an object passing data
 * and the object return all vars
 *********************************/
// OBJECT
$paginacion = new Paginacion(MAX_RECORDS_X_PAGE);
// DATA FROM !?¿
$paginacion->setTotalRegs(count($data));
// SET THE CURRENT PAGE
$paginacion->setCurrentPage($currPage);
?>
<h4>
	<?php echo $paginacion->getTotalRegs();?> registros obtenidos
</h4>

<table>
	<tr>
    	<th>ID</th>
        <th>Termino</th>
    </tr>
	<?php for($i= $paginacion->getIniReg(); $i < $paginacion->getLastReg(); $i++):?>
    <tr>
		<?php foreach ($array[$i] as $key=>$item):?>
              	<td><?php print($item);?></td>
        <?php endforeach;?>
    </tr>
    <?php endfor;?>
</table>
<div class="navPag">

<?php if ($paginacion->getTotalPages() > 1):?>

    <input type="button" value="<<" 
        onclick="xajax_nextPage(<?php echo $paginacion->getCurrentPage()-1?>);return false;" />
        
        <?php echo $paginacion->getCurrentPage()+1 .' - '.$paginacion->getTotalPages();?>  
        
    <input type="button" value=">>" 
        onclick="xajax_nextPage(<?php echo $paginacion->getCurrentPage()+1?>);return false;" />
        
<?php endif;?>

Return current item: Easy Pagination Array