Skip to content

Instantly share code, notes, and snippets.

@uno-de-piera
Created May 23, 2018 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uno-de-piera/96f5cdd3f902925690055d99c5e32dbe to your computer and use it in GitHub Desktop.
Save uno-de-piera/96f5cdd3f902925690055d99c5e32dbe to your computer and use it in GitHub Desktop.
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Post extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->load->model('post_model');
}
function index()
{
$data['title'] = 'Paginacion_ci';
$pages = 10;
$this->load->library('pagination');
$config['base_url'] = base_url().'post/pagina/';
$config['total_rows'] = $this->post_model->filas();
$config['per_page'] = $pages;
$config['num_links'] = 20;
$config['first_link'] = 'Primera';
$config['last_link'] = 'Última';
$config["uri_segment"] = 3;
$config['next_link'] = 'Siguiente';
$config['prev_link'] = 'Anterior';
$this->pagination->initialize($config);
$data["posts"] = $this->post_model->total_paginados($config['per_page'],$this->uri->segment(3));
$this->load->view('posts', $data);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment