0

I want to create an XML file that can list multiple entries - straightforward enough. But for each entry, I also want to list all of the sibling entries chosen in the Playa field for that entry. That's where things get tricky.

Putting the Playa content directly into the XML field gets no listing of the Playa choices at all, but when I tried embedding a template...I only see something that looks like (but isn't) the closing XML tag, not the beginning XML tag nor any of the expected Playa children (related titles).

What am I doing wrong?

The code for the primary XML-generation template is:

<root>{exp:channel:entries channel="spc-content" category="5" orderby="title" status="Migrated" sort="asc" limit="100"}
  <entry>
      <title>{title}</title>
      <related>{embed="group/embed-xml-related" the_id="{entry_id}"}</related>
  </entry>
{/exp:channel:entries}
</root>

The code for that embedded template is

{exp:playa:children field="playa" entry_id="{embed:entry_id}" limit="15" status="open|Featured|Created|Migrated"}
{title}
{/exp:playa:children}

The output is:

<root>
<entry>
<title>TKB Trading’s Blush Beige</title>
<related/>
</entry>
<entry>
<title>TKB Trading’s Bolera</title>
<related/>
</entry>
<entry>
<title>TKB Trading’s Brilliant Gold</title>
<related/>
</entry>
...
(and so on, until it lists 100 entries)
...
</root>
4
  • Probably just a typing mistake on the question, but your embed is using the {exp:playa:children} tag, not the {exp:playa:siblings} tag.
    – jrothafer
    Commented Mar 2, 2020 at 4:12
  • Also, you are using the embed variable property incorrectly, you are setting the_id="{entry_id}" in your embed tag, but then calling the variable like so: {embed:entry_id}. You should be calling {embed:the_id} in your embed.
    – jrothafer
    Commented Mar 2, 2020 at 4:14
  • @jrothafer That second bit did it! Can you add that as an answer so that I can mark it as "the" answer? (Now I'm seeing something similar for the tags. Back to troubleshooting that piece...)
    – The Muse
    Commented Mar 4, 2020 at 1:35
  • Have done so. Thanks!
    – jrothafer
    Commented Mar 4, 2020 at 1:41

1 Answer 1

0

Your embed is using the {exp:playa:children} tag, not the {exp:playa:siblings} tag, which you would want to use for outputting siblings from a playa field.

Also, you are using your embed variable property incorrectly. You are setting this variable:

the_id="{entry_id}"

So to access that in your embed, you'll need to use this embed variable:

{embed:the_id}

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.