Welcome Guest, Not a member yet? Register   Sign In
pagination "per_page" not working
#1

[eluser]M4rc0[/eluser]
Hi!

So i have my pagination working here, but i'm getting all the results in one page. When i click page 2 or next, it shows all the results again, it's not limiting 10 by 10 (as i want).

So i have 19 results to show, i would like page one to show 10 and page 2 to show the 9 left.
My page is showing 19 in page 1, and the same 19 in page 2.

Here's my code:
Code:
function all()
    {
        $this->load->library('pagination');
        $config['base_url'] = 'http://localhost/videoteks/index.php/movie/all/';
            $config['uri_segment'] = 3;        
            $config['num_links'] = 2;        
        $config['total_rows'] = $this->Movie_model->count_all('movies');
        $config['per_page'] = '10';
        $config['full_tag_open'] = '<div class="pagination">';
        $config['full_tag_close'] = '</div>';
        $config['cur_tag_open'] = '<span class="current">';
        $config['cur_tag_close'] = '</span>';
        $this->pagination->initialize($config);
        $data['pages'] = $this->pagination->create_links();
        $data['header'] = 'All Colection';
        $data['query'] = $this->Movie_model->get_all_movies();
        $this->template->write('pages',$data['pages']);
        $this->template->write_view('content','movie/browse',$data,TRUE);
        $this->template->render();        
    }

Am i missing something?

Also, if i leave all the $config in a configuration file, will I be able to overwrite $config['base_url'] in a different function from the controller?

All those $config will be the same, except the 'base_url' in case i want to use it in a different method, is it possible to do that way?


Messages In This Thread
pagination "per_page" not working - by El Forum - 09-26-2008, 11:41 AM
pagination "per_page" not working - by El Forum - 09-26-2008, 12:44 PM
pagination "per_page" not working - by El Forum - 09-26-2008, 01:03 PM
pagination "per_page" not working - by El Forum - 09-26-2008, 01:15 PM
pagination "per_page" not working - by El Forum - 09-26-2008, 01:32 PM



Theme © iAndrew 2016 - Forum software by © MyBB