1
How to change page using Pear-Pager in SLIM Framework?
The code of router
is:
$app->get('/imoveis(/:pg)', function($pg = '') use($app) {
$imoveis = array('casa 1', 'casa 2', 'casa 3', 'casa 4', 'casa 5', 'casa 6', 'casa 7', 'casa 8', 'casa 9', 'casa 10');
$params = array(
'mode' => 'Jumping',
'perPage' => 3,
'delta' => 4,
'itemData' => $imoveis,
'append' => false,
'path' => site_url().'imoveis/' ,
'fileName' => '%d',
'altNext' => 'Próximo',
'nextImg' => '>>Próximo',
);
$pager = Pager::factory($params);
$data = $pager->getPageData();
$links = $pager->getLinks();
$dados = array(
'titulo' => 'Nossos imóveis',
'pagina' => 'imoveis',
'menu_hover' => 3,
'dados' => $data,
'links' => $links,
);
$app->render('layout.php', $dados);
});
and that of view
is:
<?php
foreach ($dados as $item):
echo $item->codigo.'<br />';
endforeach;
echo $links['all'];
?>
When I click on the page number it simply changes in the URL but the result remains the same.
See if this can help tmb -> http://draft.studiokoalla.com/2015/03/paginacao-com-slim-framework/
– Rai Siqueira