使用语义UI进行Codeigniter分页

时间:2015-10-22 04:23:29

标签: codeigniter pagination semantic-ui

我使用以下代码进行分页:

    $config['full_tag_open'] = "<div class='ui right floated pagination menu'>";
    $config['full_tag_close'] ="</div>";
    $config['num_tag_open'] = '<a class="item">';
    $config['num_tag_close'] = '</a>';
    $config['cur_tag_open'] = '<a class="item">';
    $config['cur_tag_close'] = "</a>";
    $config['next_tag_open'] = '<a class="item">';
    $config['next_tagl_close'] = "</a>";
    $config['prev_tag_open'] = '<a class="item">';
    $config['prev_tagl_close'] = "</a>";
    $config['first_tag_open'] = '<a class="item">';
    $config['first_tagl_close'] = "</a>";
    $config['last_tag_open'] = '<a class="item">';
    $config['last_tagl_close'] = "</a>";

不使用设计部分。如何正确使用语义ui

4 个答案:

答案 0 :(得分:4)

使用此:

$config['full_tag_open'] = '<div class="ui pagination menu">';
$config['full_tag_close'] ='</div>';
$config['num_tag_open'] = '<li class="item">';
$config['num_tag_close'] = '</li>';
$config['cur_tag_open'] = '<li class="active item">';
$config['cur_tag_close'] = '</li>';
$config['next_tag_open'] = '<li class="item">';
$config['next_tagl_close'] = '</li>';
$config['prev_tag_open'] = '<li class="item">';
$config['prev_tagl_close'] = '</li>';
$config['first_tag_open'] = '<li class="item">';
$config['first_tagl_close'] = '</li>';
$config['last_tag_open'] = '<li class="item">';
$config['last_tagl_close'] = '</li>';

答案 1 :(得分:0)

在config

中创建一个文件名pagination.php

并从控制器或模型

调用它
include APPPATH.'config/pagination.php';

当您要传递此配置文件时,以下是完整代码:

$config = array();
        $config["base_url"] = base_url() . 'brands/index';
        $config["total_rows"] = $this->brand->brand_count();

        include APPPATH.'config/pagination.php';
        $this->pagination->initialize($config);

        $page = ($this->uri->segment(3)) ? $this->uri->segment(3) : 0;
        $data["results"] = $this->brand->
            get_brands($config["per_page"], $page);
        $data["links"] = $this->pagination->create_links();

                $this->load->view('brand/view',$data);

答案 2 :(得分:0)

试试这个

$config['full_tag_open'] = '<div class="ui pagination menu">';
$config['full_tag_close'] ='</div>';
$config['num_tag_open'] = '<a class="item">';
$config['num_tag_close'] = '</a>';
$config['cur_tag_open'] = '<a class="active item">';
$config['cur_tag_close'] = '</a>';
$config['next_tag_open'] = '<a class="item">';
$config['next_tagl_close'] = '</a>';
$config['prev_tag_open'] = '<a class="item">';
$config['prev_tagl_close'] = '</a>';
$config['first_tag_open'] = '<a class="item">';
$config['first_tagl_close'] = '</a>';
$config['last_tag_open'] = '<a class="item">';
$config['last_tagl_close'] = '</a>';

Semantic UI Pagination Stayles

答案 3 :(得分:0)

这是我的Bootstrap v4.0和Codeigniter v3的工作代码

$config['full_tag_open'] = '<ul class="pagination">';
$config['full_tag_close'] ='</ul>';
$config['num_tag_open'] = '<li class="page-item">';
$config['num_tag_close'] = '</li>';
$config['cur_tag_open'] = '<li class="page-item active"><a class="page-link" href="#">';
$config['cur_tag_close'] = '</a></li>';
$config['next_tag_open'] = '<li class="page-item"><a href="#" aria-label="Next">';
$config['next_tagl_close'] = '</a></li>';
$config['prev_tag_open'] = '<li class="page-item">';
$config['prev_tagl_close'] = '</li>';
$config['first_tag_open'] = '<li class="page-item disabled">';
$config['first_tagl_close'] = '</li>';
$config['last_tag_open'] = '<li class="page-item"><a href="#" aria-label="Next">';
$config['last_tagl_close'] = '</a></li>';
$config['attributes'] = array('class' => 'page-link');