The activate page is always bolded and somehow out of place. Not sure where I’m going wrong. I’m just trying to display the page links as individual links, planning to add CSS on later but can’t seem to find out how to get rid of the active page link. Also, I’m using Twitter Bootstrap 3.
Controller:
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);
}
View:
<div class="container text-right">
<ul class="pagination">
<?php foreach ($links as $link)
{
echo "<li>$link</li>";
}
?>
</ul>
</div>
2
Answers
You can change the config for your pagination like this,
and in view, you can just echo $links
Rest everything will remain same, only
config
andecho
in viewRemove this code in your code(above in controller)
and add Bootstrap code for it.
On the active tab can use Bold(
<b>
) or any other stylesan this code is working without any error. Tested
My output(Without Bold Style)