在codeigniter中调度的自定义css [英] Custom css for paging in 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'] = '« First';
$config['first_tag_open'] = '<li class="prev page">';
$config['first_tag_close'] = '</li>';
$config['last_link'] = 'Last »';
$config['last_tag_open'] = '<li class="next page">';
$config['last_tag_close'] = '</li>';
$config['next_link'] = 'Next →';
$config['next_tag_open'] = '<li class="next page">';
$config['next_tag_close'] = '</li>';
$config['prev_link'] = '← 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; ?>
,我得到的是
and what i got is
我怎么能像< -prev 1 2 3 4 5。 。 。 200下一页 - >
how can i make like <-prev 1 2 3 4 5 . . . 200 next->
是可能吗?或者可能有点好css:D(我在css中很蠢,<)
is it possible? or maybe a little nice css :D (i'm so stupid in css >,<)
推荐答案
传递到pagination initialize()
方法中的c $ c> $ config 数组,可以设置要显示在具有 num_links
的当前页面:
In the $config
array passed into the pagination initialize()
method, you can set the number of links to display on either side of the current page with num_links
:
$config['num_links'] = 2;
从 CI用户指南:
您选择的页码之前和之后的链接。例如,数字2将在任一侧放置两个数字,如在此页顶部的示例链接。
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解决方案。您还可以查看扩展CI分页库以适合您需要(查看扩展本地库)。
That should get you closer to exactly what you want. I don't know the exact HTML generated by this library, so if you post it maybe someone can give you a CSS solution. You could also look into extending the CI pagination library to suit you needs (check out "Extending Native Libraries").
这篇关于在codeigniter中调度的自定义css的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!