Welcome Guest, Not a member yet? Register   Sign In
is pagination automatic?
#1

[eluser]johnnyForums[/eluser]
If I have this code in my controller (index):

Code:
$data['title'] = 'My New Title';
        $data['heading'] = 'My New Heading';
        $this->load->model('Product_model');
        $data['query'] = $this->Product_model->get_products();
        $this->load->view('my_view',$data);
        $this->load->library('pagination');

        $config['base_url'] = 'http://127.0.0.1/catalog/index.php/products/';
        $config['total_rows'] = $this->db->count_all('tblproducts');
        $config['per_page'] = '5';
        $config['uri_segment'] = 4;
        $this->pagination->initialize($config);

        echo $this->pagination->create_links();

Is that all I need or do I need a page that actually does database work to get paging to work? I ask because this brings back all the data each time instead of just five rows. I have 30k that come back each time.


Messages In This Thread
is pagination automatic? - by El Forum - 07-23-2009, 11:32 AM
is pagination automatic? - by El Forum - 07-23-2009, 12:07 PM
is pagination automatic? - by El Forum - 07-24-2009, 10:15 AM



Theme © iAndrew 2016 - Forum software by © MyBB