Codeigniter中的create_links()无法正常工作

时间:2018-09-27 07:26:42

标签: php codeigniter

当我尝试进行分页时,它未出现在所需的位置。没有错误消息出现。此代码中有什么问题,我找不到它。 我有什么想念的吗? 这是我的控制器-方法:

public function courses()
{
    $this->load->library('pagination');


    $this->db->select('*');
    $this->db->from('courses_tbl');
    $this->db->join('course_category_tbl', 'courses_tbl.course_category_id = course_category_tbl.id');
    $this->db->limit(6, $this->uri->segment(2));
    $query = $this->db->get();
    $data['courses'] = $query->result();

    $total_records = $this->db->get('courses_tbl');

    $config['base_url'] = base_url("courses/");
    $config['total_rows'] = $total_records->num_rows();
    $config['per_page'] = 6;

    $config['full_tag_open'] = '<ul class="pagination">';
    $config['full_tag_close'] = '</ul>';

    $config['first_tag_open'] = '<li>';
    $config['last_tag_open'] = '<li>';

    $config['next_tag_open'] = '<li>';
    $config['prev_tag_open'] = '<li>';

    $config['num_tag_open'] = '<li>';
    $config['num_tag_close'] = '</li>';

    $config['first_tag_close'] = '</li>';
    $config['last_tag_close'] = '</li>';

    $config['next_tag_close'] = '</li>';
    $config['prev_tag_close'] = '</li>';

    $config['cur_tag_open'] = "<li class=\"active\"><span><b>";
    $config['cur_tag_close'] = "</b></span></li>";

    $this->pagination->initialize();

    $this->load->view('courses',$data);
}

这是我的观点:     回声$ this-> pagination-> create_links();

0 个答案:

没有答案