I'm working on a project with Fuel. I created a pagination , first page has data truly in it but when I click on other pages , uri changes but page never refresh and it doesn't show other pages. codes:
code in Controller :
$config = array(
'pagination_url' => 'http://localhost/body-app/public/app/list/',
'total_items' => 12,
'per_page' => 3,
'uri_segment' => 5,
// or if you prefer pagination by query string
//'uri_segment' => 'page',
);
$pagination = Pagination::forge('mypagination', $config);
$data['example_data'] = DB::select('*')
->from('bodies')
->limit($pagination->per_page)
->offset($pagination->offset)
->execute()
->as_array();
$data['pagination'] = $pagination;
$view=View::forge('app/list',$data);
and my foreach in View is something like this :
<?php foreach($example_data as $per) {
echo $per['name'] ;
} ?>
and finally code to show pagination :
<?php echo Pagination::instance('mypagination')->render(); ?>
'pagination' =>
object(Fuel\Core\Pagination)[21]
protected 'config' =>
array (size=12)
'current_page' => null
'offset' =>
int 0 'per_page' =>
int 3It looks like you're new here. If you want to get involved, click one of these buttons!