[eluser]Corey Freeman[/eluser]
sorry to bother everyone again. I'm using the Ajax Pagination library and I can't manage to paginate results from the controller's index (which would make the interface look so much cleaner...). Any help would be awesome.
Code:
<?php
class Dashboard extends Controller {
function dashboard() {
parent::Controller();
$this->load->library('Jquery_pagination');
if ($this->session->userdata('is_logged_in') != TRUE)
{
redirect('login');
}
}
function index() {
$data['title'] = 'Your ReveCloud Dashboard';
$this->db->where('id', $this->session->userdata('id'));
$data['user'] = $this->db->get('users');
///////////////////////////////////////////////////////////
$id = $this->session->userdata('id');
$this->db->where('user_id', $id);
$this->db->where('complete', 0);
$this->load->model('goal_model');
$total = $this->goal_model->count_goals();
$per_page = 5;
$config['base_url'] = site_url('dashboard');
$config['total_rows'] = $total;
$config['per_page'] = 5;
$config['div'] = 'body';
$config['uri_segment'] = '1';
$this->jquery_pagination->initialize($config);
$this->db->where('user_id', $id);
$this->db->where('complete', 0);
$data['dreams'] = $this->goal_model->get_goals($per_page, $this->uri->segment(1));
///////////////////////////////////////////////////////////
$this->db->where('complete', 1);
$this->db->where('user_id', $this->session->userdata('id'));
$data['complete'] = $this->db->get('goals');
$this->load->view('dashboard', $data);
}