我使用以下配置进行分页
$config['base_url'] = base_url() . 'index.php/admin/list_employees';
$config['total_rows'] = $this->database->get_num_records('user');
$config['per_page'] = 10;
$config['uri_segment'] = 3;
$config['num_links'] = 9;
$config['full_tag_open'] = '<div class="text-center"><ul class="pagination">';
$config['full_tag_close'] = '</ul></div><!--pagination-->';
它呈现为
div class="text-center"><ul="pagination"> <strong>1</strong> <a href="http://localhost/PhpProject2/index.php/admin/list_employees/10">2</a>
<a href="http://localhost/PhpProject2/index.php/admin/list_employees/20">3</a>
<a href="http://localhost/PhpProject2/index.php/admin/list_employees/30">4</a>
<a href="http://localhost/PhpProject2/index.php/admin/list_employees/40">5</a>
<a href="http://localhost/PhpProject2/index.php/admin/list_employees/50">6</a>
<a href="http://localhost/PhpProject2/index.php/admin/list_employees/60">7</a>
<a href="http://localhost/PhpProject2/index.php/admin/list_employees/70">8</a>
<a href="http://localhost/PhpProject2/index.php/admin/list_employees/80">9</a>
<a href="http://localhost/PhpProject2/index.php/admin/list_employees/90">10</a>
<a href="http://localhost/PhpProject2/index.php/admin/list_employees/10">></a>
<a href="http://localhost/PhpProject2/index.php/admin/list_employees/110">Last ›</a>
</ul></div><!--pagination-->
如何将<li>
添加到每个锚标记
答案 0 :(得分:3)
添加以下配置:
$config['num_tag_open'] = '<li>';
$config['num_tag_close'] = '</li>';
答案 1 :(得分:0)
为了根据需要将所有链接包装在分页内,您需要指定很多配置。如下:
$cfg['full_tag_open']= '<div class="cols-xs-12 text-center"><ul class="pagination">';
$cfg['full_tag_close']= '</ul></div>';
// first link
$cfg['first_tag_open']= '<li class="first">';
$cfg['first_tag_close']= '</li>';
// last link
$cfg['last_tag_open']= '<li class="last">';
$cfg['last_tag_close']= '</li>';
// current active pagination
$cfg['cur_tag_open'] = '<li class="active"><a href="#">';
$cfg['cur_tag_close'] = '</a></li>';
// number link
$cfg['num_tag_open'] = '<li>';
$cfg['num_tag_close'] = '</li>';
// next (>) link
$cfg['next_tag_open'] = '<li>';
$cfg['next_tag_close'] = '</li>';
// prev (<) link
$cfg['prev_tag_open'] = '<li>';
$cfg['prev_tag_close'] = '</li>';