<?php
class pagination extends Controller {
function __construct() {
parent::Controller();
$this->load->helper('url');
$this->load->database();
}
function index() {
// load pagination class
$this->load->library('pagination');
$config['base_url'] = base_url().'articles/index/';
$config['total_rows'] = $this->db->count_all('articles');
$config['per_page'] = '5';
$config['full_tag_open'] = '<p>';
$config['full_tag_close'] = '</p>';
$this->pagination->initialize($config);
//load the model and get results
$this->load->model('Article_model');
$data['results'] = $this->Article_model->get_article($config['per_page'],$this->uri->segment(3));
// load the HTML Table Class
$this->load->library('table');
$this->table->set_heading('id', 'title', 'image', 'category_id');
// load the view
$this->load->view('home', $data);
}
}