我无法在代码中看到我做错了什么。 我想让分页链接起作用,但我得到的结果是404错误,找不到页面......
这是我的模特:
class Clientlist extends CI_Model{
public function __construct()
{
// Call the CI_Model constructor
parent::__construct();
}
//Get full clients
public function full_list($limit) {
$sql = $this->db->get('clients', $limit);
return $sql;
}
public function count_list() {
return $this->db->count_all('clients');
}
}
这是我的观点:
foreach ($client_list->result() as $cl) {
echo $cl->fName . ' ' . $cl->lName . ' ' . $cl->cName . ' ' . $cl->cNumber . ' ' . $cl->phone . ' ' . $cl->mail .'<br />';
}
echo $this->pagination->create_links();
这是我的控制者:
$this->load->library('pagination');
$this->load->model('customers/clientlist');
$config['base_url'] = base_url('index.php/customers/cList');
$config['total_rows'] = $this->clientlist->count_list();
$config['per_page'] = 10;
$config['uri_segment'] = 3;
$this->pagination->initialize($config);
$results = $this->clientlist->full_list($config["per_page"]);
//Load the template.
$user_details = $this->login->user_details($id);
$view_info = array('username' => $user, 'details' => $user_details);
$header_info = array( 'title' => 'Registrera ny kund');
$this->load->view('template', array(
'view' => 'customers/clist',
'view_info' => $view_info,
'header_info' => $header_info,
'footer_info' => '',
'client_list' => $results,
));
你能帮助我找出我做错了吗?
谢谢!