0
我有麻煩與CI的分頁工作。 爲什麼視圖上的數據沒有改變?codeigniter分頁不會更改視圖上的數據
查看:
<section class = "home">
<table>
<?php foreach($players as $p): ?>
<tr><td><?php echo $p->uname; ?></td><td><?php echo $p->ufbid; ?></td><td><?php echo $p->uemail; ?></td><td><?php echo $p->umobile; ?></td><td><?php echo $p->points; ?></td><td><?php echo $p->pticks; ?></td></tr>
<?php endforeach; ?>
<tr><?php echo $link; ?></tr>
</table>
控制器:
$perPage = 20;
$pageConf = array(
'base_url' => site_url('home/'),
'total_rows' => $this->home_model->countPlayers(),
'per_page' => $perPage,
'uri_segment' => 2,
//'use_page_numbers' =>TRUE,
);
$this->pagination->initialize($pageConf);
$offset = $this->uri->segment(3) ? $this->uri->segment(3) : 0;
$pData = $this->home_model->displayPlayers($perPage,$offset);
$data = array(
'players'=> $pData,
'content'=> 'home',
'link' => $this->pagination->create_links()
);
$this->load->view('template/template',$data);
我已經加載的庫在我的構造方法。
來自控制器的一組記錄不會改變。我的uri第3段就是這樣的&per_page=40
。