Im creating a module with pagination, when I use the create_pagination() helper I am getting a question mark in the links. The limit has been set to 6 so I expect the links to be in sequence like 0,6,12,18 but Im getting 1?,2?,3?.
This is what is being generated:
<a href="http://site.com/mymodule/page/?">1</a>
<a href="http://site.com/mymodule/page/2?">2</a>
This is what iI was expecting:
<a href="http://site.com/mymodule/page/">1</a>
<a href="http://site.com/mymodule/page/6?">2</a>
The code Im passing in the controller is;
public function index( $offset = 0 )
{
$limit = 6;
$total_items = $this->mymodel_m->count_all();
$items = $this->mymodel_m
->limit( $limit )->offset( $offset )
->get_all();
$data->pagination = create_pagination('mymodule/page/', $total_items, $limit, 3 );
...
}
Any assistance would be greatly appreciated.
Something like this should work.
public function index()
{
$limit = 6;
$total_items = $this->mymodel_m->count_all();
$pagination = create_pagination('mymodule/page/', $total_rows , $limit, 3);
$items = $this->mymodel_m
->limit($pagination['limit'], $pagination['offset'])
->get_all();
...
}