I'm new in using codeigniter so am a bit confused now.
When I pass the players data object to the view, it lists all correctly. I'm trying to use codeigniter's pagination.
I loaded the pagination in a function in my controller:
public function playersHub(){
$playersData = $this->cms_model->getAllPlayers();
$pageConf = array(
'base_url' => base_url('home/playersHub/'),
'total_rows' => count($playersData),
'per_page' => 20,
'uri_segment' => 3,
);
$this->pagination->initialize($pageConf);
$data = array(
'players'=> $playersData,
'content'=> 'home',
'link' => $this->pagination->create_links()
);
$this->load->view('template/template',$data);
}
In my view:
<div class="container-fluid">
<div class="row-fluid">
<table class = "table table-strip">
<?php foreach($players as $p): ?>
<tr>
<td><?php echo $p->ufbid; ?></td>
<td><?php echo $p->uname; ?></td>
<td><?php echo $p->ulocation; ?></td>
<td><?php echo $p->uemail; ?></td>
<td><?php echo $p->umobile; ?></td>
<td><?php echo (($p->ugrand == 0) ? 'no':'yes'); ?></td>
<td><?php echo $p->points; ?></td>
<td><?php echo $p->pticks; ?></td>
</tr>
<?php endforeach; ?>
<tr><td colspan = "9"><?php echo $link; ?></td></tr>
</table>
</div>
I loaded the pagination in my constructor method. It creates a pagination but the data is still in one page. When I click 2 or "next", it still does the same thing.