codeigniter分页相关问题

时间:2014-08-21 09:58:10

标签: php codeigniter

$this->load->library('pagination');
$config['base_url'] = base_URL().'admin/issues/list_issues/';
$config['total_rows'] = $this->db->get('dt_issues')->num_rows();
$config['num_links']=10;
$config['per_page'] = 5;
$config['uri_segment'] = 3;

Codeigniter分页工作正常。但是当点击第一个链接时,它不起作用,剩下的链接将起作用。请帮帮我。

1 个答案:

答案 0 :(得分:-1)

$ offset是你可以获取用户需要的值的变量

function list_issues($offset = null)    
{
    $this->load->library('pagination');
     ........
     // Pagination config
   $config['base_url'] = base_URL().'admin/issues/list_issues/';
    $config['total_rows'] = $this->provider_model->countprovider();
    $config['per_page'] = 3;
    // $config['creat_link'] = 1; <-- This is not a valid option
    $config['first_link'] = 'First';
    $config['last_link'] = 'Last';
    // Init config
    $this->pagination->initialize($config);

    // If the pagination library doesn't recognize the current page add:
    $this->pagination->cur_page = $offset;

    .....
    // further your code
}