Showing Custom Pager (of counts) in CodeIgniter – Showing X to Y of Z results

Pagination in CodeIgniter is not at all perfect. Nothing is, as a matter of fact.

So one day, I had to implement this “Showing X to Y of Z results” in my SCRUD and I could not find anything on the CI website about it. A helpful Stackoverflow post was what came to the rescue. But as they say,

There is always room for improvisation.

So I made some new changes and implemented it my way. So, here goes,

  1. I made a helper file and called it in my autoload.php
  2. In the helper file, I made a function by the name displaypaginationtext
  3. Next, the code,

Call this in your controller and print it in your view and you are done.

That’s it for now!!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s