无限星辰工作室-客户无限互联网动力之源

标题: Codeigniter+Bootstrap的分页设置 [打印本页]

作者: crx349    时间: 2015-9-30 13:41
标题: Codeigniter+Bootstrap的分页设置
把这个保存在 /applications/config/pagination.php
  1. <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  2. /**
  3. * Pagination Config
  4. *
  5. * Just applying codeigniter's standard pagination config with twitter
  6. * bootstrap stylings
  7. *
  8. * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
  9. * @author Mike Funk
  10. * @link http://codeigniter.com/user_guide/libraries/pagination.html
  11. * @email mike@mikefunk.com
  12. *
  13. * @file pagination.php
  14. * @version 1.3.1
  15. * @date 03/12/2012
  16. *
  17. * Copyright (c) 2011
  18. */
  19. // --------------------------------------------------------------------------
  20.   
  21. // $config['base_url'] = '';
  22. $config['per_page'] = 15;
  23. $config['uri_segment'] = 3;
  24. $config['num_links'] = 10;
  25. $config['page_query_string'] = FALSE;
  26. // $config['use_page_numbers'] = TRUE;
  27. $config['query_string_segment'] = '';
  28. $config['use_page_numbers'] = TRUE;

  29. $config['full_tag_open'] = '<div class="pagination pagination-centered"><ul>';
  30. $config['full_tag_close'] = '</ul></div><!--pagination-->';
  31.   
  32. $config['first_link'] = '&#171; First';
  33. $config['first_tag_open'] = '<li class="prev page">';
  34. $config['first_tag_close'] = '</li>';
  35.   
  36. $config['last_link'] = 'Last &#187;';
  37. $config['last_tag_open'] = '<li class="next page">';
  38. $config['last_tag_close'] = '</li>';
  39.   
  40. $config['next_link'] = 'Next →';
  41. $config['next_tag_open'] = '<li class="next page">';
  42. $config['next_tag_close'] = '</li>';
  43.   
  44. $config['prev_link'] = '← Previous';
  45. $config['prev_tag_open'] = '<li class="prev page">';
  46. $config['prev_tag_close'] = '</li>';
  47.   
  48. $config['cur_tag_open'] = '<li class="active"><a href="">';
  49. $config['cur_tag_close'] = '</a></li>';
  50.   
  51. $config['num_tag_open'] = '<li class="page">';
  52. $config['num_tag_close'] = '</li>';
  53.   
  54. // $config['display_pages'] = FALSE;
  55. //
  56. $config['anchor_class'] = 'follow_link';
  57.   
  58. // --------------------------------------------------------------------------
  59.   
  60. /* End of file pagination.php */
  61. /* Location: ./bookymark/application/config/pagination.php */ <span></span> //使用 base_url自己看情况定义吧

  62. $config['base_url'] = site_url() . '/' . $this->uri->segment(1) . '/' . ( $this->uri->segment(2)?$this->uri->segment(2):'index') .'/';
  63.         $config['total_rows'] = $total;
  64.         $config['per_page'] = $offset;
  65.         $this->pagination->initialize($config);

  66.         $this->load->view('show'  , array('pagination' => $this->pagination->create_links() , 'sum' => $total , 'offset' => $offset ));
复制代码








欢迎光临 无限星辰工作室-客户无限互联网动力之源 (https://xmspace.net/) Powered by Discuz! X3.4