Created
January 3, 2015 13:04
-
-
Save Tjoosten/522accdcca6f28962327 to your computer and use it in GitHub Desktop.
pagination
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
models: | |
function Row_count() { | |
$Query = $this->db->get('Articles'); | |
return $Query->num_rows(); | |
} | |
function Advertenties($limit, $start) { | |
$this->db->select() | |
->limit($limit, $start); | |
$Query = $this->db->get('Articles'); | |
return $Query->result(); | |
} | |
controller: | |
$Data = array( | |
'Title' => 'Advertenties', | |
'Category' => $this->Category->get_category(), | |
); | |
// Pagination | |
// Pagination | |
$config['base_url'] = base_url() ."Advertenties"; | |
$config['total_rows'] = $this->Advertentie->Row_count(); | |
$config['per_page'] = 1; | |
$config['numlinks'] = 5; | |
$config['uri_segment'] = 2; | |
$config['full_tag_open'] = '<ul class="pagination pagination-sm">'; | |
$config['full_tag_close'] = '</ul><!--pagination-->'; | |
$config['first_link'] = '« First'; | |
$config['first_tag_open'] = '<li class="prev page">'; | |
$config['first_tag_close'] = '</li>'; | |
$config['last_link'] = 'Last »'; | |
$config['last_tag_open'] = '<li class="next page">'; | |
$config['last_tag_close'] = '</li>'; | |
$config['next_link'] = 'Next →'; | |
$config['next_tag_open'] = '<li class="next page">'; | |
$config['next_tag_close'] = '</li>'; | |
$config['prev_link'] = '← Previous'; | |
$config['prev_tag_open'] = '<li class="prev page">'; | |
$config['prev_tag_close'] = '</li>'; | |
$config['cur_tag_open'] = '<li class="active"><a href="">'; | |
$config['cur_tag_close'] = '</a></li>'; | |
$config['num_tag_open'] = '<li class="page">'; | |
$config['num_tag_close'] = '</li>'; | |
$page = ($this->uri->segment(3)) ? $this->uri->segment(2) : 0; | |
$Data['results'] = $this->Advertentie->Advertenties($config["per_page"], $page); | |
$this->pagination->initialize($config); | |
$this->load->view('components/header', $Data); | |
$this->load->view('components/navbar'); | |
$this->load->view('Advertenties', $Data); | |
$this->load->view('components/footer'); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment