Jump to content

Finding the last page number for pagination?


GuruMeditation
 Share

Recommended Posts

This solution from diogo looks clean and logical:

https://processwire.com/talk/topic/1074-get-total-pages-pagination/?p=9411

What have you tried that didn't work?

You can also get the count of pages like this:

$num_pages = $pages->count("selector");

Then obviously divide this by the number of items you are displaying on each page and then ceil() the result.

Although this option would require a second query to the database, so go with the first option if you can.

  • Like 2
Link to comment
Share on other sites

  • 2 weeks later...

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...