激活页面总是以粗体显示,并且不知何故不合适。不知道我哪里出错了。我只是试图将页面链接显示为单独的链接,计划稍后添加CSS,但似乎无法找到如何摆脱活动页面链接。另外,我使用Twitter Bootstrap 3。
控制器:
private function paginate_create_table($search = null)
{
// Set pagination configuration
$config = array();
$config['base_url'] = base_url()."index.php/Home/on_hold_lot";
$config['suffix'] = '?cust_drop_down='.$search['customer'].'&area_drop_down='.$search['stage'].'&status_drop_down='.$search['lot_status'].'&search_lot='.$search['search_lot'];
$config['first_url'] = $config['base_url'].$config['suffix'];
$config['total_rows'] = $this->home_model->fetch_lots('rows', $search);
$config['per_page'] = 10;
$config['uri_segment'] = 3;
$config['next_link'] = 'Next';
$config['prev_link'] = 'Previous';
$this->pagination->initialize($config);
$page = ($this->uri->segment(3)) ? $this->uri->segment(3) : 0;
$results = $this->home_model->fetch_lots('array', $search, $config['per_page'], $page);
return $results;
}
public function load_lot_table()
{
// Get form values
if($this->input->get())
{
$search = array(
'customer' => $this->input->get('cust_drop_down'),
'stage' => $this->input->get('area_drop_down'),
'lot_status' => $this->input->get('status_drop_down'),
'search_lot' => $this->input->get('search_lot')
);
}
else
{
$search = array(
'customer' => 'all',
'stage' => 'all',
'lot_status' => 'all',
'search_lot' => ''
);
}
// Paginate retrieved lots
$results = $this->paginate_create_table($search);
if($results != FALSE)
{
// Assign retrieved lots to assoc array
$data['disp_rows'] = $results;
// Create page links for Next page, Page 1 etc
$str_links = $this->pagination->create_links();
$data['links'] = explode(" ", $str_links);
}
else
{
$data['error_message'] = "No rows";
}
return $this->load->view('home/lot_disposition', $data);
}
查看:
<div class="container text-right">
<ul class="pagination">
<?php foreach ($links as $link)
{
echo "<li>$link</li>";
}
?>
</ul>
</div>
答案 0 :(得分:1)
在代码中删除此代码(在控制器上方)
$config['next_link'] = 'Next';
$config['prev_link'] = 'Previous';
并为其添加Bootstrap代码。
// style
$config['full_tag_open'] = '<ul class="pagination">';
$config['full_tag_close'] = '</ul>';
$config['first_link'] = false;
$config['last_link'] = false;
$config['first_tag_open'] = '<li>';
$config['first_tag_close'] = '</li>';
$config['prev_link'] = '«';
$config['prev_tag_open'] = '<li class="prev">';
$config['prev_tag_close'] = '</li>';
$config['next_link'] = '»';
$config['next_tag_open'] = '<li>';
$config['next_tag_close'] = '</li>';
$config['last_tag_open'] = '<li>';
$config['last_tag_close'] = '</li>';
$config['cur_tag_open'] = '<li class="active"><a href="#">';//this is active tab
$config['cur_tag_close'] = '</a></li>';
$config['num_tag_open'] = '<li>';
$config['num_tag_close'] = '</li>';
在活动标签上可以使用粗体(<b>
)或任何其他样式
此代码正常运行,没有任何错误。的测试强>
我的输出(没有粗体)
答案 1 :(得分:0)
您可以像这样更改您的分页配置
$config['last_link'] = 'Last';
$config['last_tag_open'] = '<li>';
$config['last_tag_close'] = '</li>';
$config['full_tag_open'] = '<ul class="pagination">';
$config['full_tag_close'] = '</ul>';
$config['first_link'] = 'First';
$config['first_tag_open'] = '<li>';
$config['first_tag_close'] = '</li>';
$config['cur_tag_open'] = '<li class="active"><a href="#">';
$config['cur_tag_close'] = '</a></li>';
$config['num_tag_open'] = '<li>';
$config['num_tag_close'] = '</li>';
$config['prev_link'] = '«';
$config['prev_tag_open'] = '<li>';
$config['prev_tag_close'] = '</li>';
$config['next_link'] = '»';
$config['next_tag_open'] = '<li>';
$config['next_tag_close'] = '</li>';
并且在视图中,您可以回显$ links
<div class="container text-right">
<?= $links ?>
</div>
休息一切都将保持不变,只有config
和echo
在视野中