Jump to content

Pagination


mulikp
 Share

Recommended Posts

Hi all,

I have a gallery section on site, where I have shown year-wise images and this section utilizes pagination. when you click on page 2 you will be able to see all the images that were posted in 2021 and on page 3 you will be able to see the year 2020's images. and I want to display years in descending order(i.e.: 2022, 2021,2020,.....) instead of 1,2,3 on pagination.

Pleas find the below attached image to see the structure I've created for gallery section in a processwire:

Capture.PNG.a36b54ffa09acf958e8a2850318a7cbf.PNG

and this is how I fetch data on my page :

Capture.PNG.2e22f2005918399e24e0e2d67f8b7f3f.PNG

Capture.PNG.f4f45a37719d3fb6a49b702c56777b65.PNG

and the below code is for pagination

Capture.PNG.1e29ce4eb70e19c70904475cb337a06a.PNG

And this is how my section looks like :

tempsnip.thumb.png.b74067c39c94fa50282ee68d81ccf0d7.png

I'm not sure how to go about this so any direction would be helpful.

Thanks

Link to comment
Share on other sites

Why did you create a new user account to ask the same question like 

again?

This could be considered spam. You should better ask follow up questions in your first thread.

Did you read @millipedia's answer?

It pretty much explains how you would go about. For rendering your "pagination" links you can use something like this simplified sample code:

foreach ($mygallery as $gallery) {
    echo "<a href='{$mygallery->url}{$gallery->title}'>{$gallery->title}</a>";
}

 

  • Like 1
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

  • Recently Browsing   0 members

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