Created
July 4, 2018 14:13
-
-
Save mianaliasjad/1dce852902f726d919f2650080d55799 to your computer and use it in GitHub Desktop.
This uses Twitter Bootstrap 4.1 classes for CodeIgniter pagination. Drop this file into application/config.
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
<?php | |
/** | |
* Pagination Config | |
* | |
* Just applying codeigniter's standard pagination config with twitter | |
* bootstrap 4.1 stylings | |
* | |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0 | |
* @author Ali Asjad | |
* @link http://codeigniter.com/user_guide/libraries/pagination.html | |
* @email [email protected] | |
* | |
* @file pagination.php | |
* @date 07/04/2018 | |
*/ | |
// -------------------------------------------------------------------------- | |
if ( ! defined('BASEPATH')) exit('No direct script access allowed'); | |
$config['full_tag_open'] = '<nav aria-label="Page navigation" class="pagination-nav"><ul class="pagination">'; | |
$config['full_tag_close'] = '</ul></nav>'; | |
$config['num_tag_open'] = '<li class="page-item">'; | |
$config['num_tag_close'] = '</li>'; | |
$config['cur_tag_open'] = '<li class="page-item active"><span class="page-link">'; | |
$config['cur_tag_close'] = '<span class="sr-only">(current)</span></span></li>'; | |
$config['next_tag_open'] = '<li class="page-item">'; | |
$config['next_tagl_close'] = '<span aria-hidden="true">»</span></li>'; | |
$config['prev_tag_open'] = '<li class="page-item">'; | |
$config['prev_tagl_close'] = '</li>'; | |
$config['first_tag_open'] = '<li class="page-item d-none">'; | |
$config['first_tagl_close'] = '</span></li>'; | |
$config['last_tag_open'] = '<li class="page-item d-none">'; | |
$config['last_tagl_close'] = '</li>'; | |
$config['next_link'] = 'Next'; | |
$config['prev_link'] = 'Previous'; | |
$config['use_page_numbers'] = TRUE; | |
// -------------------------------------------------------------------------- | |
/* End of file pagination.php */ | |
/* Location: /application/config/pagination.php */ | |
/* After pasting this file then goto the controller where you are creating pagination and then paste lines given below */ | |
/* $config=[ | |
'base_url' => your base url, | |
'per_page' => 5, | |
'total_rows' => your total rows number | |
]; | |
$config['attributes'] = array('class' => 'page-link'); //it is necessary | |
$this->pagination->initialize($config); | |
Now to show pagination just call | |
echo $this->pagination->create_links(); */ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment