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
#2

Hi,

Try this url : http://localhost/my_program/index.php/page/2

If it works you need to use an .htaccess to remove the index.php from the url.
Reply
#3

(This post was last modified: 04-14-2015, 10:18 AM by pompeu.)

thanks for answering,

did not work , I went up the system on my server , I would like if possible to come in and look what is happening , follow the
link: www.claranet.com.br/sgi3

User : admin@admin.com
Password: 123456

the menu click entries and leaders , will see that aperecendo is as it should be but does not update the table and loses the setting, I configured the routers for $route ['leaders/:num'] = ' leaders ' ;

and I configured uri but still does not work

thank you

Ps: i am brazilian ^^
Reply
#4

(This post was last modified: 04-14-2015, 10:57 AM by pompeu.)

Problem solved,

had not put base_url in the flame of css and js and not put the function index in the paging :

Code:
$config['base_url'] = base_url() . 'leaders/index/';

Thanks for the answer ^^ you always helping me.
Reply
#5

Cool Smile
Reply




Theme © iAndrew 2016 - Forum software by © MyBB