2

I'm trying to display the count/position of the entries i've selected in the Playa field, but can't seem to figure it out. For example in my Playa field I have...

Test Post
Another Test Post
Yet Another Test Post

But do each one of these posts have a count / position number in Playa? e.g.

1 - Test Post
2 - Another Test Post
3 - Yet Another Test Post

But If I was to reorder them to:

Another Test Post
Test Post
Yet Another Test Post

The count should still count up...

1 - Another Test Post
2 - Test Post
3 - Yet Another Test Post

All I can seem to output is the count of the entry which always displays "1" or the entry_id.

My code is:

{exp:channel:entries channel="course" url_title="{segment_2}" dynamic="no"}
     {cf_course_content} {!-- Playa Field --}
          {count}
     {/cf_course_content}
{/exp:channel:entries}
1
  • I only see the behavior you're referring to if I use {parent:count}. It seems to work just fine when using {count}. Jan 23 '13 at 0:08
5

In theory {count} should work. If it’s always being output as ‘1’ that means that {exp:channel:entries} (or another module tag pair you’re not telling us about?) must be parsing the tag before Playa had a chance to claim it.

Try adding your own custom var_prefix to your Playa tag pair, and apply that var_prefix to the {count} variable tag, as well as any other tags that are meant to be parsed by Playa:

{cf_course_content var_prefix="cc"}
    {cc:count}. {cc:title}
{/cf_course_content}
1
  • EPIC. This works. Totally missed the var_prefix parameter in the docs. Works a charm now. Thank you for your reply.
    – Jason Mayo
    Jan 24 '13 at 11:23
0

Maybe try with Pvl_Increment. It counts on every call.

1
  • Possibly... But I'm trying not to bring another add-on in to the problem.
    – Jason Mayo
    Jan 22 '13 at 15:03

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.