Good day,
Quick question,
I am using CI's pagination to my project,
it works perfectly, but i wanted to add some
filters on it.
i.e. I need to catch its click event.
although I can catch already its click event using this
$("ul.pagination > li a[href]").click(function(e){
loadingStart();
});
my problem is it still redirect to the next page,
what I need is something like this.
if(myVar == 0) {
//do not redirect
} else {
//redirect.
}
Use e.preventDefault(); and then execute your custom function
If you want filter for pagination that use $_GET ... no redirect in js (You can not undo, etc.).
I show you how I do:
Controller:
/**
Example list
**/
public function index()
{
$page = ($this->input->get('page') AND $this->input->get('page')>1)?(intval($this->input->get('page'))-1)*9:1; #9 item for page
#where if isset($_GET)
$where = array();
if($this->input->get('city')) {
$where['users.city'] = $this->input->get('city');
}
if($this->input->get('street')) {
$where['users.street'] = $this->input->get('street');
}
#load model
$this->load->model('users_m');
$view_data['users'] = $this->users_m->GetAll($where,$page,array('users.register_date'=>'DESC'))->result();
//pagination library
$this->load->library('pagination');
$config['base_url'] = site_url('/users');
$config['total_rows'] = $this->users_m->GetAll($where,0)->num_rows();
$config['per_page'] = 9;
$config['full_tag_open'] = "<ul class='pagination'>";
$config['full_tag_close'] ="</ul>";
$config['num_tag_open'] = '<li>';
$config['num_tag_close'] = '</li>';
$config['cur_tag_open'] = "<li class='disabled'><li class='active'><a href='#'>";
$config['cur_tag_close'] = "<span class='sr-only'></span></a></li>";
$config['next_tag_open'] = "<li>";
$config['next_tagl_close'] = "</li>";
$config['prev_tag_open'] = "<li>";
$config['prev_tagl_close'] = "</li>";
$config['first_tag_open'] = "<li>";
$config['first_tagl_close'] = "</li>";
$config['last_tag_open'] = "<li>";
$config['page_query_string'] = TRUE;
$config['query_string_segment'] = 'page';
$config['reuse_query_string'] = TRUE;
$config['use_page_numbers'] = true;
$config['last_tagl_close'] = "</li>";
$this->pagination->initialize($config);
//variable to template
$view_data['pagination'] = $this->pagination;
$this->load->view('/users/index',$view_data);
}
Model: users_m
/**
* Get all users example
**/
public function GetAll($where=array(),$page=1,$order_by=array(),$limit=9)
{
$this->db->select('users.*');
#order by
if(count($order_by)>0)
{
foreach($order_by as $key=>$value)
{
$this->db->order_by($key,$value);
}
}
$this->db->where($where);
#show all (for pagination calculate)
if($page==0) return $this->db->get_where('users',$where);
#show single page
return $this->db->get_where('users',$where,$limit,(($page==1)?$page-1:$page));
}
And view:
<div id="search_bar">
<?php echo form_open(site_url('/users'),array('class'=>'form-inline','method'=>'get'));?>
<div class="form-group col-lg-2 col-md-4 col-sm-4">
<select name="type" class="form-control">
<option value="" disabled="disabled" selected="selected" >City</option>
<option value="1" <?php if(set_value('city')==1) echo 'selected';?>>London</option>
<option value="2" <?php if(set_value('city')==2) echo 'selected';?>>Warsaw</option>
</select>
</div>
<button type="submit" class="btn btn-primary" style="margin-top:-10px;">Search</button>
<?php echo form_close();?>
</div>
<hr/>
<div id="grid-user" class="row">
<table>
<tbody>
<?php foreach($users as $user):?>
<tr>
<td><?php echo $user->id;?></td>
<td><?php echo $user->firstname;?></td>
<td><?php echo $user->lastname;?></td>
<td><?php echo date("d.m.Y",strtotime($user->register_date));?></td>
</tr>
<?php endforeach;?>
</tbody>
</table>
</div>
<div class="row">
<div class="col-lg-12">
<div style="float:right;"><?php echo $pagination->create_links();?></div>
</div>
</div>
I sorry for my english.
This is example (not checked, written from memory).
Try it :)
Related
I am trying to create a simple pagination in my CodeIgniter blog, here is my code, I am using auto loader for these
$autoload['libraries'] = array('database','session','pagination');
$autoload['helper'] = array('form','url');
My Controller;
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Blog extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->model('BlogModel');
}
public function index($offset=0)
{
$this->load->library('table');
$config["base_url"] = base_url('blog');
//$config["total_rows"] = $this->BlogModel->get_Count(); // There are currently 36 Posts
$config["total_rows"] = 36; // There are currently 36 Posts
$config["per_page"] = 5; // Change limit to suit what you would like
$config['use_page_numbers'] = TRUE;
$limit = $config['per_page'];
$this->pagination->initialize($config);
$blog_pagination = $this->pagination->create_links();
$Posts = $this->BlogModel->get_Posts($limit, $offset);
$assignData=array('data'=>$Posts,'blog_pagination'=>$blog_pagination);
$this->load->view('header');
$this->load->view('blog', $assignData);
$this->load->view('footer');
}
}
I Have this in my Model;
<?php
class BlogModel extends CI_Model {
public function __construct(){
// Call the Model constructor
parent::__construct();
$this->load->library('memcached_library');
}
public function get_Posts($limit, $offset){
$this->db->select('*');
$this->db->where('post_status','published');
$query= $this->db->get('cms_posts',$limit, $offset);
$data=$query->result_array();
return $data;
}
public function get_Count() {
//$query = $this->db->get($this->db->dbprefix . 'blog');
$this->db->select('*')->from('cms_posts');
$this->db->where('post_status','published');
$query= $this->db->get();
//$data=$query->result_array();
return $query->num_rows();
}
}
?>
I am using this in my View;
<div id="primary" class="left-column">
<?php
if(!empty($data)){
foreach($data as $row){
?>
<main id="main" role="main">
<article id="<?php echo $row['post_id']; ?>" class="post-item">
<div class="right">
<div class="post-thumbnail">
<img src="<?php echo base_url()."assets/images/uploads/test_n-150x150.jpg";?>" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="" sizes="(max-width: 320px) 100vw, 320px" width="320" height="143">
</div>
<!-- END .post-thumbnail -->
</div>
<div class="left">
<h2 class="post-title">
<?php echo $row['post_title']; ?>
</h2>
<div class="post-meta">
<span class="vcard author">
<?php echo ucwords($row['post_author']); ?>
</span>
<time class="entry-date published" datetime="<?php echo $row['post_date']; ?>"><?php echo date("d M Y", strtotime($row['post_date'])); ?></time>
</div>
<div class="post-excerpt">
<p>
<?php
echo(substr($row['post_content'], 0, 250));
<a class="read-more" href="<?php echo base_url()."blog/".$row['post_url']; ?>">Read More »</a>
</p>
</div>
<!-- END .post-excerpt -->
</div>
<!-- END .left -->
</article>
<!-- END .post-item -->
</main>
<?php
}
}
?>
<!-- END .site-main -->
<div class="pagination-wrap">
<?php echo $blog_pagination; ?>
</div>
</div>
EDIT:
My Route is as under:
$route['default_controller'] = 'index';
$route['blog/:any'] = 'blog/post/$1';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
I don't know that what and where are I am missing something, please lead me or correct me in this code. thnk you
Update
My Blog show now 5 Post on First Page and create Pagination but on only 123>Last› pagination is created and there is page blank on offset 2 (/blog/2).
maybee you can use my methode use uri segment to $offset, like this
public function house()
{
$config['base_url'] = site_url().'/user/house/';
$config['total_rows'] = $this->houses->select_row_house_design();
$config['per_page'] = 12;
$config['cur_tag_open'] = '<li><a><b>';
$config['cur_tag_close'] = '</li></a></b>';
$config['prev_tag_open'] = '<li>';
$config['prev_tag_close'] = '</li>';
$config['next_tag_open'] = '<li>';
$config['next_tag_close'] = '</li>';
$config['num_tag_open'] = '<li>';
$config['num_tag_close'] = '</li>';
$config['last_tag_open'] = '<li>';
$config['last_tag_close'] = '</li>';
$config['first_tag_open'] = '<li>';
$config['first_tag_close'] = '</li>';
$this->pagination->initialize($config);
$from = $this->uri->segment('3');
$data['design'] = $this->houses->select_all_house_design($config['per_page'],$from);
$title['menu'] = 'house design';
$this->template('user/house',$data,$title);
}
set controller like this,
this is also simple
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Blog extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->model('BlogModel');
$this->load->library('table');
}
public function index($offset=0)
{
$config['base_url'] = site_url('blog/index');
$config["total_rows"] = $this->BlogModel->get_Count(); // There are currently 36 Posts
$config["per_page"] = 5; // Change limit to suit what you would like
$config['num_links'] = 10;
/*use this code for bootstrap
$config['full_tag_open'] = '<ul class="pagination">';
$config['full_tag_close'] = '</ul>';
$config['num_tag_open'] = '<li>';
$config['num_tag_close'] = '</li>';
$config['cur_tag_open'] = '<li class="active"><a class="">';
$config['cur_tag_close'] = '</a></li>';
$config['prev_tag_open'] = '<li class="prev">';
$config['prev_tag_close'] = '<li>';
$config['next_tag_open'] = '<li class="next">';
$config['next_tag_close'] = '</li>';
$config['num_tag_open'] = '<li>';
$config['num_tag_close'] = '</li>';
$config['first_link'] = '<<';
$config['first_tag_open'] = '<li>';
$config['first_tag_close'] = '</li>';
$config['last_link'] = '>>';
$config['last_tag_open'] = '<li>';
$config['last_tag_close'] = '</li>';
*/
$this->pagination->initialize($config);
$data['blog_pagination'] = $this->pagination->create_links();
$data['posts'] = $this->BlogModel->get_Posts($config['per_page'],$this->uri->segment(3));
$this->load->view('header');
$this->load->view('blog', $data);
$this->load->view('footer');
}
}
I'm trying to make a pagination for a query. I can't figure why is the reason that the pagination doesn't work, it shows the pagination links, right now I have 15 records and I want to show that in batches of 5, but in the page # 1 I see the 15 records and when I click in the second page link I have an error that says that the page doesn't exist.
This is my model "searchCases":
//Function to get the active cases
function getCases(){
$query = $this->db->
select('*')->
from('customer_complaint')->
where('active', 1)->
get();
return $query->result();
}
//Function to get the number of opened cases
function countCases(){
$query = $this->db->
select('*')->
from('customer_complaint')->
where('active', 1)->
get();
return $query->num_rows();
}
// Function to retrieve a list of all the records of the table an the params $limit and $start to
// determine the number of records to return and what record to start from.
function fetchCases($limit, $start){
$this->db->limit($limit, $start);
$query = $this->db->
select('*')->
from('customer_complaint')->
where('active', 1)->
get();
if ($query->num_rows() > 0) {
foreach ($query->result() as $row) {
$data[] = $row;
}
return $data;
}
return false;
}
}
Now this is my Controller "opened_cases":
public function index(){
$this->load->view('headers');
$this->load->view('navbar');
$data['query'] = $this->searchCases->getCases();
$config['base_url'] = base_url().'index.php/opened_cases/';
$config['total_rows'] = $this->searchCases->countCases();
$config['per_page'] = 5;
$config['uri_segment'] = 2;
$config['full_tag_open'] = "<ul class='pagination'>";
$config['full_tag_close'] ="</ul>";
$config['num_tag_open'] = '<li>';
$config['num_tag_close'] = '</li>';
$config['cur_tag_open'] = "<li class='disabled'><li class='active'><a href='#'>";
$config['cur_tag_close'] = "<span class='sr-only'></span></a></li>";
$config['next_tag_open'] = "<li>";
$config['next_tagl_close'] = "</li>";
$config['prev_tag_open'] = "<li>";
$config['prev_tagl_close'] = "</li>";
$config['first_tag_open'] = "<li>";
$config['first_tagl_close'] = "</li>";
$config['last_tag_open'] = "<li>";
$config['last_tagl_close'] = "</li>";
$this->pagination->initialize($config);
$page = ($this->uri->segment(2)) ? $this->uri->segment(2) : 0;
$data["results"] = $this->searchCases->
fetchCases($config["per_page"], $page);
$this->load->view('opened_cases', $data);
$this->load->view('footer');
}
and my View "opened_cases":
<div class="col-sm-12">
<div class="panel panel-default">
<div class="panel-heading">Search Results:
</div><!--End of Panel Heading-->
<div class="panel-body">
<table class="table" style="text-align: center">
<tr>
<td>Case ID</td>
<td>Received Date</td>
<td>Folio</td>
<td>Transactions Date</td>
<td>Reason of Complaint</td>
<td>Source of Complaint</td>
<td>Files</td>
</tr>
<?php
foreach ($query as $row) {?>
<tr>
<td><?= $row->complaint_id?></td>
<td><?= date('m/d/Y', strtotime($row->received_date))?></td>
<td><?= $row->folio?></td>
<td><?= date('m/d/Y', strtotime($row->tx_date))?></td>
<?php
$this->load->model('searchCases');
$id=$row->complaint_id;
$reason_id=$this->searchCases->reason($id);
$source_id=$this->searchCases->source($id);
foreach ($reason_id as $rsn) {
if($rsn->reason == 'Others'){
echo "<td class='text-left'>".$rsn->reason.": ".$row->other_reason."</td>";
}else{
echo "<td class='text-left'>".$rsn->reason."</td>";
}
}
foreach ($source_id as $src) {
echo "<td>".$src->source."</td>";
}
?>
<td><?php
$folder = $row->complaint_id;
$path_root = "upload/".$folder."/";
$dir = scandir($path_root, 1);
$array_lenght = count($dir)-2;
if($array_lenght>=1){?>
<span class="glyphicon glyphicon-paperclip"></span>
<?php } ?></td>
</tr>
<?php }?>
</table>
</div><!--End of body panel-->
<div class="panel-footer text-center">
</div><!--End of Panel Footer-->
</div><!--End of Panel-->
<div class="col-sm-12 text-center">
<?= $this->pagination->create_links() ?>
</div> <!-- End of pagination -->
</div>
Here is an image of my view:
15 records instead of 5
UPDATE:
I realize my mistake:
$data['query'] = $this->searchCases->getCases(); //I deleted this line, because i was getting all the results of the query.
and now in the view I replace $results instead $query in the foreach cycle and now I can see the 5 results per page that I'm asking for.
foreach ($query as $row) {?>
<tr>...
Changed to:
foreach ($results as $row) {?>
<tr>...
But now when I click on the link for the second page I have the same error 404 that I had from the start.
Try this $config['base_url'] = base_url().'index.php/opened_cases/index';
And change this $config['uri_segment'] = 3;
I have 3 sections in my view, there is one section of a review I want that part of a view to change when user selects another page link that must refresh only the paging div. My code for simple Pagination in Codeigniter is as follows and works perfectly.
Controller: home.php
<?php
class Home extends CI_Controller {
public function __construct() {
parent::__construct();
$this->load->model('MovieModel');
$this->load->library('pagination');
}
public function index($offset=0){
$config['total_rows'] = $this->MovieModel->totalMovies();
$config['base_url'] = base_url().'/home/index';
$config['per_page'] = 5;
$config['uri_segment'] = '3';
$config['full_tag_open'] = '<div class="pagination"><ul>';
$config['full_tag_close'] = '</ul></div>';
$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>';
$this->pagination->initialize($config);
if($this->uri->segment(3))
{
$offset = $this->uri->segment(3);
}
else
{
$offset = 0;
}
$query = $this->MovieModel->getMovies(5,$offset);
//$query = $this->MovieModel->getMovies(5,$this->uri->segment(3));
$data['MOVIES'] = null;
if($query){
$data['MOVIES'] = $query;
}
$this->load->view('index1.php', $data);
}
}
?>
MovieModel.php
<?php
class MovieModel extends CI_Model {
function getMovies($limit=null,$offset=NULL){
$this->db->select("MOVIE_ID,FILM_NAME,DIRECTOR,RELEASE_YEAR");
$this->db->from('trn_movies');
$this->db->limit($limit, $offset);
$query = $this->db->get();
return $query->result();
}
function totalMovies(){
return $this->db->count_all_results('trn_movies');
}
}
?>
index1.php
<!DOCTYPE html>
<html lang="en">
<head>
<title>Codeigniter Pagination Example</title>
<link href="<?=base_url();?>css/bootstrap.css" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="row">
<h4>Movies List</h4>
<table class="table table-striped table-bordered table-condensed">
<tr><td><strong>Movie Id</strong></td><td><strong>Film Name</strong></td><td><strong>Director</strong></td><td><strong>Release Year</strong></td></tr>
<?php
if(is_array($MOVIES) && count($MOVIES) ) {
foreach($MOVIES as $movie){
?>
<tr><td><?=$movie->MOVIE_ID;?></td><td><?=$movie->FILM_NAME;?></td><td><?=$movie->DIRECTOR;?></td><td><?=$movie->RELEASE_YEAR;?></td></tr>
<?php
}
}?>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="row"><?php echo $this->pagination->create_links(); ?></div>
</div>
</div>
</div>
</body>
</html>
This cannot be done in PHP alone.
You will have to use AJAX to update the section on your page.
The suggested approach would be:
use jQuery to detect the button click.
Send a request to your Codeigniter backend.
jQuery detects on success, using the data printed by the backend to update the container in your frontend.
See: http://blog.teamtreehouse.com/beginners-guide-to-ajax-development-with-php
I am working on Codeigniter Pagination and following this link :
http://www.technicalkeeda.com/codeigniter-tutorials/pagination-using-php-codeigniter
but when i click on further links i.e. 1,2 and so on then the next sequence of records does not loads up only the initial (from 1 to 5 shows up) i have seen other links on stackoverflow : CodeIgniter Pagination Page Links Not Working but it did not work. My code is as follows, please help to solve my problem:
Controller: home.php
<?php
class Home extends CI_Controller {
public function __construct() {
parent::__construct();
$this->load->model('MovieModel');
$this->load->library('pagination');
}
public function index($offset=0){
$config['total_rows'] = $this->MovieModel->totalMovies();
$config['base_url'] = base_url().'/home/index';
$config['per_page'] = 5;
$config['uri_segment'] = '2';
$config['full_tag_open'] = '<div class="pagination"><ul>';
$config['full_tag_close'] = '</ul></div>';
$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>';
$this->pagination->initialize($config);
$query = $this->MovieModel->getMovies(5,$this->uri->segment(2));
$data['MOVIES'] = null;
if($query){
$data['MOVIES'] = $query;
}
$this->load->view('index1.php', $data);
}
}
?>
MovieModel.php
<?php
class MovieModel extends CI_Model {
function getMovies($limit=null,$offset=NULL){
$this->db->select("MOVIE_ID,FILM_NAME,DIRECTOR,RELEASE_YEAR");
$this->db->from('trn_movies');
$this->db->limit($limit, $offset);
$query = $this->db->get();
return $query->result();
}
function totalMovies(){
return $this->db->count_all_results('trn_movies');
}
}
?>
View: index1.php
<!DOCTYPE html>
<html lang="en">
<head>
<title>Codeigniter Pagination Example</title>
<link href="<?= base_url();?>css/bootstrap.css" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="row">
<h4>Movies List</h4>
<table class="table table-striped table-bordered table-condensed">
<tr><td><strong>Movie Id</strong></td><td><strong>Film Name</strong></td><td><strong>Director</strong></td><td><strong>Release Year</strong></td></tr>
<?php
if(is_array($MOVIES) && count($MOVIES) ) {
foreach($MOVIES as $movie){
?>
<tr><td><?=$movie->MOVIE_ID;?></td><td><?=$movie->FILM_NAME;?></td><td><?=$movie->DIRECTOR;?></td><td><?=$movie->RELEASE_YEAR;?></td></tr>
<?php
}
}?>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="row"><?php echo $this->pagination->create_links(); ?></div>
</div>
</div>
</div>
</body>
</html>
Use the below coding
if($this->uri->segment(3))
$offset = $this->uri->segment(3);
else
$offset = 0;
$query = $this->MovieModel->getMovies(5,$offset);
It so nightmare when using pagination on codeigniter. It work to move another page when click next or number after. But, the 'cur_tag_open' is not move. It still in first link of pagination. So let say, I clicked 3 on [1] [2] [3] , the class active still in one not in three. I can not find the solution of this problem, and this is my code :
CONTROLLER
class Control_direksi extends CI_Controller {
public function index() {
$this->show();
}
public function show() {
/** ======================================================= Inisialisasi table 1 =========================================================* */
$start_row = $this->uri->segment(4);
$per_page = 2;
if (trim($start_row) == '') {
$start_row = 0;
};
$total_rows = $this->model_request->hitungRequestMasukMD();
$this->load->library('pagination');
if ($total_rows != 0) {
$config['base_url'] = base_url() . 'direksi/control_direksi/show/';
$config['total_rows'] = $total_rows;
$config['per_page'] = $per_page;
$config['full_tag_open'] = '<div class="pagination pagination-centered" id="pagination1"><ul>';
$config['full_tag_close'] = '</ul></div><!--pagination-->';
$config['first_link'] = false;
$config['last_link'] = false;
$config['first_tag_open'] = '<li>';
$config['first_tag_close'] = '</li>';
$config['prev_link'] = 'Prev';
$config['prev_tag_open'] = '<li class="prev">';
$config['prev_tag_close'] = '</li>';
$config['next_link'] = 'Next';
$config['next_tag_open'] = '<li>';
$config['next_tag_close'] = '</li>';
$config['last_tag_open'] = '<li>';
$config['last_tag_close'] = '</li>';
$config['cur_tag_open'] = '<li class="active"><a href="#">';
$config['cur_tag_close'] = '</a></li>';
$config['num_tag_open'] = '<li>';
$config['num_tag_close'] = '</li>';
$this->pagination->initialize($config);
$data['pagination'] = $this->pagination->create_links();
}
$data['level'] = $this->session->userdata('level');
$data['pengguna'] = $this->model_user->get_username($this->session->userdata('username'));
$data['data_request_done'] = $this->model_request->get_data_request_belum_terkoreksi($per_page, $start_row);
$data['hitung_Request_Masuk_MD'] = $total_rows;
$this->load->view('direksi/view_direksi', $data);
}
VIEW
<body>
<!-- start: Header -->
<?php $this->load->view('/direksi/include/header.php') ?>
<!-- start: Header -->
<div class="container-fluid-full">
<div class="row-fluid">
<noscript>
<div class="alert alert-block span12">
<h4 class="alert-heading">Warning!</h4>
<p>You need to have JavaScript enabled to use this site.</p>
</div>
</noscript>
<!-- start: Content -->
<marquee>Jumlah Request Masuk ke MD: <?php echo $hitung_Request_Masuk_MD . ' request' ?></marquee>
<div class="box-header">
<h2><i class="halflings-icon align-justify"></i><span class="break"></span>Request masuk ke IT</h2>
<div class="box-icon">
<i class="halflings-icon chevron-up"></i>
</div>
</div>
<div class="box-content" id="things_table">
<?php $this->load->view('direksi/view_direksi_table'); ?>
</div>
</div>
</div>
<!-- end: Content -->
<?php $this->load->view('direksi/view_direksi_table_modal', TRUE); ?>
<div class="clearfix"></div>
<?php $this->load->view('/include/js.html', TRUE); ?>
</body>
Any help, it so appreciated
change 01
$start_row = $this->uri->segment(4);//remove this
and post after
$config['base_url'] = base_url() . 'direksi/control_direksi/show/';
$config['total_rows'] = $total_rows;
$config['per_page'] = 2;
$config['uri_segment'] = 3;//Uri_Segment
Change 02
$data['pagination'] = $this->pagination->create_links();
modify like this
$page = ($this->uri->segment(3)) ? $this->uri->segment(3) : 0;//Add this line
$data['links'] = $this->pagination->create_links();
Change 03
in view.
where you want show your pagination list just use
<?php
echo $links;
?>
Important load this library in controller as well
$this->load->library('pagination');