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,
- I made a helper file and called it in my autoload.php
- In the helper file, I made a function by the name displaypaginationtext
- Next, the code,
Call this in your controller and print it in your view and you are done.
That’s it for now!!