2

I'm creating a custom plugin for customer reviews on products. In the CP I have an interface to view and aprove these. What I am wondering is if it is any easy way to paginate my records? Right now on my index page Im just calling a twig extension that does a DB query for all rows in a review table. When this table gets bigger I might have performance and UX issues listing all the comments in one go.

Any help would be appreciated.

1

You should be able to use paginate. In my installation, I paginate through blog articles:

{% paginate craft.entries.section('articles').limit(4) as pageInfo, articles %}

Then, you can just access them as usual:

{% for article in articles %}
    {{ article.title }}
{% endfor %}
  • 1
    I am looking to paginate my custom records, so I cant use craft.entreis to fetch my own objects. – Syversen Dec 7 '17 at 11:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.