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 <a href=”http://www.surfscripts.com/wp-content/uploads/2007/07/sctpagination.zip” title=”CodeIgniter PaginationV1.0″>download CodeIgniter PaginationV1.0</a> 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.
<code>$this-&gt;load-&gt;library('sctPagination');</code>

The best way to load is to use it in the Controller constructor.

Step 4.

Define an array for the config varibales.

<code>
$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-&gt;sctpagination-&gt;initialize($config);</code>

/*
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-&gt;sctpagination-&gt;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.