[eluser]Kemik[/eluser]
Hello,
I have a pagination on my page listing users of my site. When I click "2" for the 10 to 20 users on my pagination links it changes to display the correct users, but the menu continues with "1" in bold.
Controller
Code:
function all()
{
// load pagination class
$this->load->library('pagination');
$config['base_url'] = base_url().'admin/users/all/';
$config['total_rows'] = $this->db->count_all('users');
$config['per_page'] = '10';
$config['full_tag_open'] = '<p>';
$config['full_tag_close'] = '</p>';
$this->pagination->initialize($config);
//load the model and get results
$this->load->model('admin/user_model');
$data['results'] = $this->user_model->get_users($config['per_page'],$this->uri->segment(4));
// load the HTML Table Class
$this->load->library('table');
$this->table->set_heading('User ID', 'Username', 'Email', 'Action');
$data['header'] = '[Admin] Manage Users';
$data['page'] = 'admin/users';
$this->load->view('container', $data);
}
Model
Code:
function get_users($num, $offset)
{
/*echo 'Num: ';
echo $num;
echo 'Off: ';
echo $offset;
exit();*/
$this->db->select('user_id, user_name, email');
$query = $this->db->get('users', $num, $offset);
return $query;
}
View
Code:
<h1>Admin :: Manage Users</h1>
<p>
<?php echo $this->table->generate($results); ?>
<?php echo $this->pagination->create_links(); ?>
</p>
Thanks for your help.
edit: Fixed. Needed to add $config['uri_segment'] = 4;