Jump to content

Recommended Posts

Posted

Hey, i'm currently building a website with a news section. On the overview page I would like to add a pagination so that users can easily switch from page to page.

I already included the MarkupPagerNav setup. However I would like to adjust the output of the module and I'm not really sure how to adjust it to my needs. I would e.g. like to output the current page and the total number of pages. See example below of what I would like to achieve:

image.thumb.png.e04203955f6f4e5940671c09adad7b40.png

Could someone point me in the right direction on how to output the correct variables?

Thanks!

Posted

The "1 to 10 of 20" part is something you get from PaginatedArray::getPaginationString() rather than from MarkupPagerNav. So if your paginated results are in a variable named $results you would do something like this:

<p>Showing <?= $results->getPaginationString() ?> results</p>

And the Previous/Next navigation: unfortunately MarkupPagerNav doesn't provide a direct solution for this. There's an open request for it: https://github.com/processwire/processwire-requests/issues/248
So for now you have to hide the numbered links with CSS (the easy option) or code your own Previous/Next links.

  • Like 2
Posted

@Robin S That's really great! Will use the combined setup with getPaginationString() and MarkupPagerNav to achieve the pagination markup.

Thanks, for pointing me in the right direction!

  • Like 1

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...