[eluser]elusid[/eluser]
I'm making a standard CRUD system while toying with CodeIgniter trying to learn the ropes....
Here is my problem.
I want to do pagination on a database query. I've got pagination working and its displaying the correct data in my 'view' using the table helper. The problem is that I would like to add links to ID's within my table. Can I change how the data is being displayed within the table and turn my ID's column into links?
here is my code:
The controler
Code:
function index() {
//checks if user is logged in
if ($this->session->userdata('logged_in') != TRUE) {
redirect('login');
}
$this->load->library('pagination');
$this->load->library('table');
$config['base_url'] = base_url().'admin/index';
$config['total_rows'] = $this->db->get('uploads')->num_rows();
$config['per_page'] = 5;
$config['num_links'] = 20;
$config['full_tag_open'] = '<div id="pagination">';
$config['full_tag_close'] = '</div>';
$this->pagination->initialize($config);
$query = $this->db->get('uploads', $config['per_page'], $this->uri->segment(3));
$data['records'] = $query->result_array();
$this->load->view('admin_view', $data);
}
my view
Code:
<div style="padding:10px 10px 10px 10px;">
<?php $this->table->set_heading('ID','File Name', 'Location');?>
<?php echo $this->table->generate($records); ?>
?>
<?php echo $this->pagination->create_links(); ?>
Thanks ahead for any help i'm in love with CodeIgniter its been a fun learning process.