codeigniter pagination stack overflow code example

Example: codeigniter pagination stack overflow

$total = $this->bmodel->countResultsBanner();
    $data['total'] = $total;
/* Comment out this part
        $uri_segment = $this->uri->segment(4);
        if($uri_segment == 0 || empty($uri_segment)){
        $uri_segment = 0;
        }
    */
    $perPage = 5;
    $config['base_url'] = base_url()."index.php/modules/banner/index";
    $config['total_rows'] = $total;
    $config['per_page'] = $perPage;
    $config['num_links'] = 4;
    //$config['cur_tag_open'] = '<b><span class="current_page">';
    //$config['cur_tag_close'] = '</span></b>'; 
    $this->pagination->initialize($config); 
/*Change the following line*/
 $result = $this->bmodel->getAllBanners($perPage,$this->uri->segment(5));
    $data['result'] = $result;

Tags:

Php Example