привет, мое разбиение на страницы не работает.CodeIgniter Pagination не отображает правильные строки на странице
Это мой класс контроллера. customer_controller.php
public function __construct()
{
parent::__construct();
$this->load->helper('url');
$this->load->model('customer_model');
$this->load->library('pagination');
}
public function index()
{
$data['title']= 'Customer';
$data['records'] = $this->customer_model->getAll();
$data['groups'] = $this->customer_model->getAllCustomerGroups();
$data['groupcodes'] = $this->customer_model->getAllCustomerGroups();
$config['base_url'] = 'customers';
$config['total_rows'] = $this->customer_model->record_count();
$config['per_page'] = 1;
$config["uri_segment"] = 3;
$page = ($this->uri->segment(3)) ? $this->uri->segment(3) : 0;
$data["customers"] = $this->customer_model->fetch_customers($config["per_page"], $page);
$data["links"] = $this->pagination->create_links();
//$this->pagination->initialize($config);
//echo $this->pagination->create_links();
$this->load->view('include/header',$data);
$this->load->view('include/navbar',$data);
$this->load->view('customer_view', $data);
$this->load->view('include/sidebar',$data);
$this->load->view('include/footer',$data);
}
Customer_model.php
public function fetch_customers($limit, $start) {
$this->db->limit($limit, $start);
$query = $this->db->query('SELECT customercode, customername, customergroup, customertype, customeraddress, website FROM customercard');
if ($query->num_rows() > 0) {
foreach ($query->result() as $row) {
$data[] = $row;
}
return $data;
}
return false;
}
customer_view.php
<?php
foreach ($customers as $key => $value)
{
echo '<p>'. $value->customercode . '</p>';
echo '<p>'. $value->customername . '</p>';
}
?>
Моя проблема в том, что это просто отображение всех записей, а не только показывать 1 запись за раз. а также мои ссылки на страницы не отображаются. Что я здесь делаю неправильно? Помощь очень ценится. Благодарю.
+1 на раскомментирован заявление пагинация инициализации. Это было также первое, что я видел неправильно, поэтому не хотел создавать для него новый ответ. –