Welcome Guest, Not a member yet? Register   Sign In
Pagination with problem
#1

Hello , I am using paging IC , did everything as is in the case of the documentation , but I have a problem when I click the link to view other data it gives page not found and my url looks like this: http://localhost/my_program/page/2

what am I doing wrong ?

my controller:

Code:
    public function index($offset = 0) {

        $limite = 2;
        $this -> load -> model("m_lideres", "lideres");
        $dados['count_paginacao'] = $this -> lideres -> count_paginacao($limite, $offset);
        $dados['contador'] = $this -> db -> count_all ('lideres');

        //PAGINAÇÃO
        $this -> load -> library('pagination');
        $config['base_url'] = base_url() . 'lideres/';
        $config['total_rows'] = $this -> db -> get('lideres') -> num_rows();
        $config['per_page'] = $limite;
        $config['uri_segment'] = 3;
        $config['first_link'] = 'Primeiro';
        $config['last_link'] = 'Ultimo';
        $this->pagination->initialize($config);
        $dados['paginacao'] = $this->pagination->create_links();
        //PAGINAÇÃO

        $this -> load -> view('header');
        $this -> load -> view('menu');
        $this -> load -> view('v_cad_lideres', $dados);
        $this -> load -> view('footer');
    }

My model:

Code:
public function count_paginacao($limite, $offset) {

        $this -> db -> limit($limite, $offset);
        $count = $this -> db -> get('lideres');
        return $count -> result();

    }

    public function lideres($id = null) {
            
        if ($id != null) {
            $this->db->where("id", $id);
        }
        
        $this->db->order_by("nome");
        return $this->db->get("lideres");
            
    }

Thanks ^^
Reply


Messages In This Thread
Pagination with problem - by pompeu - 04-14-2015, 08:58 AM
RE: Pagination with problem - by aurelien - 04-14-2015, 09:53 AM
RE: Pagination with problem - by pompeu - 04-14-2015, 10:17 AM
RE: Pagination with problem - by pompeu - 04-14-2015, 10:56 AM
RE: Pagination with problem - by aurelien - 04-14-2015, 02:28 PM



Theme © iAndrew 2016 - Forum software by © MyBB