2

I guess I'm missing something obvious since I haven't found any question on this subject… I'm trying to paginate results from exp:playa:parents tags to no avail… That's what I got:

{exp:playa:parents parent_id="{low_events:entry_ids}" disable="categories|category_fields" limit="5" paginate="bottom"}
  HTML…
  {paginate}
    {pagination_links}
    <ul>
      {page}
      <li><a href="{pagination_url}" class="{if current_page}active{/if}">{pagination_page_number}</a></li>
      {/page}
    </ul>
    {/pagination_links}
  {/paginate}
{/exp:playa:parents}

From the Playa docs, it sounds like I'm supposed to override disable="pagination" which i set to true by default. That's what I'm going for with disable="categories|category_fields" and that's the only thing I can think of that might be the problem… (I don't actually know if that's how you're supposed to override the default).

Any idea? Thanks!

5
  • Your override is correct for disable. What output do you get? Do you see the {pagination} tags unprocessed, or do they parse yet are empty? Maybe a stupid question: do you have more than 5 entries in the {low_events:entry_ids} field? What happens if you manually append /P5 to the URL? Commented Oct 19, 2013 at 1:59
  • I've actually changed the limit to 1 for testing anyway (and I got more than 1 entry ;) It doesn't output anything (which means the pagination tags are parsed I guess). Manually changing the URL doesn't change the output… Thanks!
    – Yann
    Commented Oct 19, 2013 at 12:23
  • 1
    Hmm. Are you by chance using either Structure or Freebie? Commented Oct 19, 2013 at 18:52
  • Nope. I'm using a few add-ons but nothing unusual… The only one I've never used before that might have something to do with it is low_events but as far as I can tell, it's only outputting a list of IDs for Playa to work with. Maybe I'll code up a jQuery pagination instead… Bummer though. Thanks for trying to sort it out! It's always good to get a second pair of eyes on a problem :)
    – Yann
    Commented Oct 20, 2013 at 17:46
  • Im having this same issue. It outputs the pagination links, which bring you to the correct url (P25 for example), but the results on the page dont change.
    – user2503
    Commented Dec 14, 2013 at 17:24

2 Answers 2

6

I don't know if you already have a anwser yet. But I had the same problem and I. I want to enable pagination within a Playa loop.

You need to do 2 things to enable pagination in a Playa loop.

  • Override the default disable of “categories|category_fields|member_data|pagination”.
  • Put var_prefix in your Playa tag and pagination tag.

You did a good override of the default disables with disable="categories|category_fields" but also disable="" will work if you want to enable all this.

So you only have to do a prefix in your loop and your code should look something like this:

{exp:playa:parents parent_id="{low_events:entry_ids}" disable="categories|category_fields" limit="5" paginate="bottom" var_prefix="your_prefix"}
  HTML…
  {your_prefix:paginate}
    {pagination_links}
    <ul>
      {page}
      <li><a href="{pagination_url}" class="{if current_page}active{/if}">{pagination_page_number}</a></li>
      {/page}
    </ul>
    {/pagination_links}
  {/your_prefix:paginate}
{/exp:playa:parents}

I hope this helps you.

2
  • Thanks a bunch! I ended up going another route so I can't verify if your solution works in this particular case, but I will definitely try it out when I have time. Where did you find info on var_prefix ? I find the docs to be really lacking since they updated their site. Thanks again!
    – Yann
    Commented Jan 14, 2014 at 16:32
  • Thats a good question. It cost me a few days to find the right solution. I read somewhere(don't ask me where, i don't remeber) if you want to use pagination in a Playa loop you need to use var_prefix. I did that and it still didn't work. The Playa docs chapter var_prefix explains you need to enable pagination. But I didn't know how to do this. Then I come across your question. You explained to me how I need to enable pagination. I combined me knowledge with yours and there it was :). So thanks to you to!
    – Nielex
    Commented Jan 15, 2014 at 9:40
2

Have you tried following the instructions here: https://getsatisfaction.com/pixelandtonic/topics/pagination_in_playa#reply_6602199 ?

2
  • broken link :'(
    – Yann
    Commented Jan 14, 2014 at 16:33
  • Yeah, GetSat killed it a month or so ago :( Meanwhile, it was a similar approach that Nielex suggested above, only not using var_prefix but an embed. His way is smarter, by the way :) Commented Jan 15, 2014 at 8:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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