Je suis nouveau en utilisant codeigniter donc je suis un peu confus maintenant.pagination codeigniter ne se charge pas correctement
Lorsque je passe l'objet de données de joueurs à la vue, il répertorie tous correctement. J'essaie d'utiliser la pagination de codeigniter.
Je chargé la fonction en pagination dans mon contrôleur:
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);
}
À mon avis:
<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>
Je chargé la pagination dans ma méthode constructeur. Il crée une pagination mais les données sont toujours dans une page. Quand je clique sur 2 ou "suivant", ça fait toujours la même chose.
vous devez appeler 'getAllPlayers()' 'nouveau avec certains limit' pour afficher –
appeler dans la vue? –