1

I have a home channel in which I want to display various Playa fields bringing entries in from other channels. It's tricky though, home is a listing item as it will change everyday (Note the start and stop). The information Playa brings in is also from a listing.

{exp:channel:entries channel="home" limit="1" start_on="{current_time format="%Y-%m-%d 00:00"}" stop_before="{current_time format="%Y-%m-%d 23:59"}"}

{exp:playa:children channel="articles" field_id="18" parse="inward"}
{title}
{/exp:playa:children}

{/exp:channel:entries}

The problem here is that the Playa field always shows the title from the home listing, not the article listing even though I specified the channel in the Playa field. From looking at the Playa docs, this should work fine. Any suggestions?

1

Have you tried the simple fieldtype tag pair for the playa child entries loop to see if that returns the data you're looking for?

{cf_your_playa_field_short_name}
  {title}
{/cf_your_playa_field_short_name}
| improve this answer | |
  • That works! I wonder why this simple example isn't in the docs and why the exp:playa one is. – Paul Redmond Apr 3 '13 at 8:13
  • It is but it's way down at the bottom of the docs. I tend to lean on the exp:playa tag pair, but when it isn't behaving quite the way I expect, sometimes simply reverting to the fieldtype tag pair is the simplest solution. I'm not sure how it compares tag-wise, but on the surface it seems to mirror exactly what exp:playa:children is supposed to do. – Jean St-Amand Apr 3 '13 at 12:26
  • You're right, well spotted. Thanks again for your simple solution. – Paul Redmond Apr 3 '13 at 16:16
1

Not sure I get it but I'll take a shot. parse=inward is not needed here, nor is the field_id I don't think. Also, I would use single quotes inside double quotes to avoid parsing problems. The following code should work provided that:

  • a home entry is displayed by the outer channel entries tag
  • you have entries belonging to the "articles" channel that are playa children of the "home" entry and that have a status of "open"

Could you give it a try?

{exp:channel:entries channel="home" limit="1" start_on="{current_time format='%Y-%m-%d 00:00'}" stop_before="{current_time format='%Y-%m-%d 23:59'}"}

    <h1>home entry title: {title}</h1>
    {exp:playa:children channel="articles"}
        <h2>article entry title: {title}</h2>
    {/exp:playa:children}

{/exp:channel:entries}
| improve this answer | |
  • Thanks for your reply, I found the solution which is posted below. I appreciate you leaving an answer! – Paul Redmond Apr 3 '13 at 8:14
  • Hey Paul, exp:playa:children should work as well IMHO. In fact I have very similar working code. Would be interested in finding out what the problem was in your case. – Jérôme Coupé Apr 3 '13 at 8:18
  • The only other thing I can think of is I use the Stash module. I wonder if parse order is stopping it from working. – Paul Redmond Apr 3 '13 at 16:15
  • Well, difficult to know without the full context but, in the code samples you gave, if there is no stash code between your father entry loop and playa:children either should work I think. Thanks for getting back on that. Glad you got it working in the end. – Jérôme Coupé Apr 3 '13 at 20:01

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.