CodeIgniter Forums
pagination? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: pagination? (/showthread.php?tid=42255)



pagination? - El Forum - 06-01-2011

[eluser]Jin Nguyen[/eluser]
I did pagging at index.php but i can do it at categories
But what the paging needs "$this->uri->segment(3)".
I used "$this->uri->segment(3)" to get categories_id. I add the "$this->uri->segment(4)" but it just jumps to the last page of crude(this page valuable segment (4)). The remaining pages are not segment (4).
help me!
Controller
Code:
function categories(){
        $category_book = $this->uri->segment(3);
        $where = array('category_id' => $category_book);
        $this->load->library('pagination');    
        $start_row = $this->uri->segment(4);
        $per_page = 5;
        if(trim($start_row)=='')
        {
            $start_row = 0;
        }
        $things = $this->global_model->get_total_number_record('sach',$where);
        $total_row = $things;
        $config['base_url'] = site_url().'/site/categories/'.$category_book.'/';
        $config['total_rows'] = $total_row;
        $config['per_page'] = $per_page;
        $this->pagination->initialize($config);
        $paging = $this->pagination->create_links();
        $data=array(
                       'Sach' =>  $this->global_model->get_info_type_book($where,$per_page,$start_row),
                       'pagination' => $paging,
                       'view'=>'site/sanpham/showSach'
                   );
        $this->load->view('site/templates/default/index',$data);
    }



pagination? - El Forum - 06-01-2011

[eluser]osci[/eluser]
add
Code:
$config['uri_segment'] = 4;



pagination? - El Forum - 06-01-2011

[eluser]Jin Nguyen[/eluser]
[quote author="osci" date="1306936975"]add
Code:
$config['uri_segment'] = 4;
[/quote]
Thanks you ^^
i did it.