Welcome Guest, Not a member yet? Register   Sign In
Pagination & search
#1

[eluser]Guerra[/eluser]
Hi all, how to make that pages links looked 1/2/3…. instead of 1/3/6…
Controller:
Code:
function search($offset = ''){
    if ($this->input->post('term')){
        $this->session->set_userdata('keyword', $this->input->post('term'));
    }
            
    $total = $this->search->searchc($this->session->userdata('keyword'));
    $config['base_url'] = base_url().'blog/search';
    $config['total_rows'] = $total;
    $config['per_page'] = 3;
            
    $config['uri_segment'] = 3;
            
    $this->pagination->initialize($config);
            
    $data['pag_links'] = $this->pagination->create_links();
            
    $data['results'] = $this->search->searcht($config['per_page'],$offset,$this->session->userdata('keyword'));
    $data['title'] = 'Search | '. $this->session->userdata('keyword');
    $data['navigate'] = $this->mcats->getNav();
    $data['main'] = 'search';
    $this->load->view('template',$data);            
}
Model:
Code:
function searchc($term){
    $this->db->select('id,title,url,body,cat_name');
    $this->db->like('title',$term);
    $this->db->orlike('body',$term);
    $this->db->orderby('title','asc');
    return $this->db->count_all_results('topics');
}

function searcht($limit,$offset,$term){
    $this->db->limit($limit,$offset);
    $this->db->select('id,title,url,body,cat_name');
    $this->db->like('title',$term);
    $this->db->orlike('body',$term);
    $this->db->orderby('title','asc');
    $Q = $this->db->get('topics');
    return $Q->result();
}
I so understand the need to edit pagination library :grrr:
Please help with a code :red:




Theme © iAndrew 2016 - Forum software by © MyBB