4.7.3 Paginación
Se encuentran en el archivo
pagination.hlp.php y agrupa los helpers utilizados para la paginación de resultados. Existe también la posibilidad, de realizar la paginación mediante AJAX. Para esto se ha creado el helper paginationRemote.
function pagination($pager)Descripción
Pagina los resultados de un listado de registros.
Parámetros:
- Object $pager Instancia de OP_Pager
- Devuelve String
Ejemplo
//...
<table>
//...
<?php foreach ($posts as $post): ?>
<tr>
<td><?php echo $post['id_post']; ?></td>
<td><?php echo linkTo("blog/post/view?id_post=".$post['id_post'],$post['title']); ?></td>
<td><?php echo $post['created']; ?></td>
<td><?php echo linkTo("blog/post/edit?id_post=".$post['id_post'], 'Edit'); ?>
<?php echo linkTo("blog/post/delete?id_post=".$post['id_post'],'Delete', 'onclick="return confirm(\'¿Estás seguro?\')"' ); ?></td>
</tr>
<?php endforeach; ?>
<tfoot>
<tr>
<th colspan="4">
<div id='pagination'>
<?php echo pagination($pager)?>
</div>
</th>
</tr>
</tfoot>
</table>
//...
function paginationRemote($pager, $update)Descripción
Pagina los resultados de un listado de registros. Realiza las peticiones mediante AJAX, utilizando el helper linkToRemote.
Parámetros:
- Object $pager Instancia de OP_Pager
- String $update ID del
donde se mostrará la respuesta.
- Devuelve StringEjemplo paginación Remote(AJAX):
//...
<div id='contenido-informacion'>
//...
<tfoot>
<tr>
<th colspan="4">
<div id='pagination'>
<?php echo paginationRemote($pager, 'contenido-informacion')?>
</div>
</th>
</tr>
</tfoot>
</tfoot>
</table>
</div>
//...
Formulario | Url