php - 在 codeigniter 中用于分页的自定义 css

标签 php html css codeigniter pagination

我需要一点帮助,

我想使用分页 CodeIgniter。

这是我用于显示分页的代码。

    $this->load->library("pagination");
    $config = array();
    $key = $this->input->get_post('qfront');
    $config["base_url"] = base_url() . "source/";
    $config["total_rows"] = $this->fetch_count($key)->count;
    $config["per_page"] = 10;
    $choice = $config["total_rows"] / $config["per_page"];
    $config["uri_segment"] = 2;
    $config["num_links"] = round($choice);
    $config['full_tag_open'] = '<div class="pagination"><ul>';
    $config['full_tag_close'] = '</ul></div><!--pagination-->';

    $config['first_link'] = '&laquo; First';
    $config['first_tag_open'] = '<li class="prev page">';
    $config['first_tag_close'] = '</li>';

    $config['last_link'] = 'Last &raquo;';
    $config['last_tag_open'] = '<li class="next page">';
    $config['last_tag_close'] = '</li>';

    $config['next_link'] = 'Next &rarr;';
    $config['next_tag_open'] = '<li class="next page">';
    $config['next_tag_close'] = '</li>';

    $config['prev_link'] = '&larr; Previous';
    $config['prev_tag_open'] = '<li class="prev page">';
    $config['prev_tag_close'] = '</li>';

    $config['cur_tag_open'] = '<li class="active"><a href="">';
    $config['cur_tag_close'] = '</a></li>';

    $config['num_tag_open'] = '<li class="page">';
    $config['num_tag_close'] = '</li>';
    $this->pagination->initialize($config);
    $page = ($this->uri->segment(2)) ? $this->uri->segment(2) : 0;
    $data["results"] = $this->fetch_result($config["per_page"], $page, $key);
    $data["links"] = $this->pagination->create_links();
    $data["key"] = $key;
    $this->load->view("page", $data);

在我看来:

<?php echo $links; ?>

我得到的是 enter image description here

我怎样才能像<-prev 1 2 3 4 5 一样。 。 。 200 下一个->

这可能吗?或者也许是一些漂亮的 css

最佳答案

在传递给分页initialize()方法的$config数组中,您可以使用设置当前页面两侧显示的链接数量>num_links:

$config['num_links'] = 2;

来自CI user guide :

The number of "digit" links you would like before and after the selected page number. For example, the number 2 will place two digits on either side, as in the example links at the very top of this page.

这应该会让你更接近你想要的。我不知道这个库生成的确切 HTML,所以如果你发布它,也许有人可以给你一个 CSS 解决方案。您还可以查看extending the CI pagination library以满足您的需求(查看“扩展 native 库”)。

关于php - 在 codeigniter 中用于分页的自定义 css,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20573882/

相关文章:

PHP-Build - 构建 PHP 5.3.28 错误

php - 如何用 PHP 调试 prepare 语句?

html - float 和小屏幕的问题

html - 如何在输入元素内移动输入的文本?

javascript - 如何从字符串中去除具有属性的 HTML 标签?

php - Jquery 获取所有输入值并创建一个数组(带有名称)

html - 左右对齐消息气泡

css - 为什么这些媒体查询不会相互覆盖?

html - 离线使用 JSbin.com 或 CSSDesk?

asp.net - 从 ASP.NET 在 Facebook 中将 div 内容共享为图像