Jump to content

How do I get summary of pagination like '11-20 of 200 results'?


Vigilante
 Share

Recommended Posts

I'm using pagination but I want to place a summary text somewhere in the template.

Basically my query has a limit=20 so somewhere on the page I want to say something like "Showing 21 through 40 of 290 results".

I can get the total results by doing my query again with $pages->count() unless this is not performant? But how do I know that I'm viewing 21-40 results? And on the last page where it might not be returning a full 20 pages, it would probably say something like "Showing 281-290".

I thought I could just do some math using the $input->pageNum and then calculating based on my limit=20. This just seems messy somehow. I'm looking for a better way unless there is no better way.

Thanks

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...