Pagination for Loopers

Hey, congrats on getting the beta out, this one’s especially exciting :slight_smile:

Wanted to bring up the idea of pagination for Loopers. Was playing around with the NASA example just quick and thought it would be nice if we could have some pagination to break up large amounts of results. This has also come up before when outputting some CPT items on a regular page for example. There currently is no pagination available in such cases.

Lazy loading more results, automatically or with a ‘load more’ button, is very common too, which I think should be included as well if you do decide to give us pagination :sunglasses: Not a big fan of lazy loading myself (except for images and stuff like that) as there are UX issues with it on a lot of sites that use it, but choice is good.

2 Likes

Glad you are excited for this beta. So there’s a couple of things to solve on our end here. I did not know this sort of problem existed for CPT’s so I appreciate the message.

Being able to either increment or decrement a number. IE the looper index + 1, or the page number - 1. This is short work for a templating engine. That didn’t poll well, but with inner dynamic content we can get a basic math group to do something like {{dc:math:increment x="{{dc:url:param key='page'}}"}}.

Pipe in different data into the Post Pagination element. I have to check how this element works internally. In your CPT test I’m assuming this element did not work?

Dynamic Loopers, is my working title, for a way Loopers to “load” more as you have described. It’s a system that extends to us being able to pipe data on the fly to Cornerstone elements. Maybe not done at same time, but that would relate to features like live data piped into a Cornerstone Chart.

2 Likes

Yes, the Post Pagination element currently does nothing when it is not placed on an Archive template. It shows up blank in the CS editor and on the front end when used on any other page as far as I can tell. That rules out your dynamic content math solution :sweat_smile:

So if I understand correctly, the best way to do something like this will be with the upcoming Dynamic Loopers feature?

1 Like

Having looked more at the Pagination element, yeah it’s using paginate_links which I believe only uses the global query. I do see a request from last year that is identical to this so I’ll make sure we take a look at some point.

For your second part, yeah the “Load More” feature I can’t see working without us adding more features. Loopers are just building HTML right now, I don’t think there is a way to interact with them through AJAX. At least not easily.

2 Likes

Sounds promising that we may see some improvements here in the future, thanks for looking into it!

AJAX would be a nice bonus. You know people are going to ask for it anyway, haha.

1 Like

Hello charlie,

Thanks for that input. Do we have any ETA regarding this ?

Thank you very much

1 Like

The template engine I was referring to was Twig. Which is coming in 6.5.0. Probably going to automatic updates the week of July 8th. Have a great day.

Hello,

Thank you for that answer.

So i have been trying to play around this, but it still seems that it does not work, eventhough i am running PHP 8.1 and PRO 6.5.0

Am i missing something ?
thank you

It’s all good, sorry i misread something.

everything is running and that update is DOPE !!!

Thanks !

1 Like