Hello Friends,
Pagination is the basic component of listing pages. If you are new in Codelgniter and want to use paging in your listing pages. Please follow the below code for the same:
1) Open your listing controller where you want to show listing
// define paging library
$this->load->library('pagination');
//set your listing page path like in the below line users in my controller name and flag is the controller function make sure /page/ put in the last
$config['base_url'] = URL . 'users/flags/page/';
// set total number of records here
$config['total_rows'] = $nos_allFlags;
// set records per page
$config['per_page'] = 20;
// Initialize paging
$this->pagination->initialize($config);
2) Now open your view file and put the below code where you would like to show paging
echo $this->pagination->create_links();
0 Comment(s)