我的控制器工作: -分頁鏈接不codeginiter
function all_leads($offset = 0) {
$where = '';
$search['search_status'] = FALSE;
$username = $this->session->userdata('username');
$user_id = $this->extra_functions->get_user_id($username);
$this->load->library('pagination');
$user_type = $this->extra_functions->get_user_type($user_id);
if ($this->input->get('search')) {
$serach_string = $this->input->server('QUERY_STRING');
$config['enable_query_strings'] = TRUE;
$config['suffix'] = '?' . $serach_string;
$search_data = $this->input->get();
$where = $this->lead_model->lead_search_coundtiotn($search_data);
if ($where != NULL) {
$where = $where;
} else {
$where = '';
}
$main_data['search'] = TRUE;
$main_data['search_data'] = $search_data;
}
$num_rows = $this->lead_model->count_leads($user_id, $user_type, $where);
$config['base_url'] = base_url('lead/all_leads');
$config['total_rows'] = $num_rows;
$config['per_page'] = 10;
$config['use_page_numbers'] = TRUE;
$config['full_tag_open'] = '<ul class="pagination">';
$config['full_tag_close'] = '</ul>';
$config['prev_link'] = '«';
$config['prev_tag_open'] = '<li>';
$config['prev_tag_close'] = '</li>';
$config['next_tag_open'] = '<li>';
$config['next_tag_close'] = '</li>';
$config['cur_tag_open'] = '<li class="active"><a href="#">';
$config['cur_tag_close'] = '</a></li>';
$config['num_tag_open'] = '<li>';
$config['num_tag_close'] = '</li>';
$config['num_links'] = 5;
$config['first_link'] = 'First';
$config['first_tag_open'] = '<li>';
$config['first_tag_close'] = '</li>';
$config['last_link'] = 'Last';
$config['last_tag_open'] = '<li>';
$config['last_tag_close'] = '</li>';
$config['next_link'] = '»';
$this->pagination->initialize($config);
$main_data['all_leads'] = $this->lead_model->view_leads_sec($config['per_page'], $offset, $search, $user_id, $user_type, $where);
$main_data['totalRecords']=$num_rows;
$this->load->view('crm/leads/all_leads', $main_data);
}
什麼是錯誤? – Hassaan
它不顯示任何錯誤只是分頁鏈接不正常工作。它跳過一些記錄時,我試圖搜索任何東西。搜索工作正常只是分頁鏈接不工作正常... – Ruhanika
你設置會話和偏移值應該根據你的url_segment – riya