CodeIgniter Pagination Class
This is an easy Pagination class for CodeIgniter PHP Framework.
I just wanted to implement a pagination script with Codeigniter Framework. I found the default pagination library file within CodeIgniter, but it returned the output as a string of links. But, I needed a different one which returns the out put as an array. I didn’t find anything in this category for CodeIgniter, so I wrote SctPagination.
SctPagination is a simple PHP class which is working together with CodeIgniter Pagination class. It extends the parent class and uses it variables for processing the data.
You can freely download CodeIgniter PaginationV1.0 and use it, modify it, delete it…………….
Usage:
step 1.
Download the latest version of sctPagination.
Step 2.
Extract it to your ’system/application/libraries’ folder.
Step 3.
Load the pagination class to the application using the Load function of the CodeIgniter Framework.
$this->load->library('sctPagination');
The best way to load is to use it in the Controller constructor.
Step 4.
Define an array for the config varibales.
$config['base_url'] = site_url('controller/method');//The URL used in the pagination links
$config['total_rows'] = N;//The total number of results that has to be paginated
$config['per_page'] = M;//The number of items to be displayed in each page
//Initializes and loads the basic Pagination class
$this->sctpagination->initialize($config);
/*
It will execute the statement and load the $paginationArray variable with the paginated URLs. You can use this array to display the pagination links in your site.
*/
$paginationArray = $this->sctpagination->getLinksArray();
You can contact me for more support and bugs at : support@surfscripts.com.
Please feel free to drop a comment if you need any modifications on it.

















Hi,
Thanks for this. Is it possible to give us an example or a quick tutorial using your class,
thanks