0

I am running

  • EE 2.5.2
  • Playa 4.3.3
  • Matrix 2.4.3

I have a matrix field inside channel entries pair tag. The first column in that matrix is a playa field type. That playa field relates to a matrix on another site that is run by MSM.

This is all generating a table in my template.

what i have so far

I have successfully pulled the playa children using the following:

{matrix_field} <tr> {if plhotel} <!--playa column--> <td> {exp:playa:children site="mysite" field="hotels" limit="1"} {hotel-name} <!--desired playa value--> {/exp:playa:children} </td> {/if} <td>{other matrix value}</td> <td>{other matrix value}</td> </tr> {/matrix_field}

my issue

I need for the playa tag to pull one child per row. This is almost certainly an issue with how I've constructed the loop, I'm openly admitting this. I can't seem to prevent the playa loop from displaying all children in the first row. As you'll see I've even tried setting limit="1" in the tag which I almost knew would fail. This produced the same child in all rows of the table (still not correct).

Any advice is appreciated.

1 Answer 1

0

Not sure if this will create any parse issues, but here's a restructure for you:

{matrix_field}
{if plhotel} <!--playa column-->
{exp:playa:children site="mysite" field="hotels"}     
<tr>
    <td>
        {hotel-name} <!--desired playa value-->
    </td>
    <td>
        {other matrix value}
    </td>
    <td>
        {other matrix value}
    </td>
</tr>
{/exp:playa:children}
{/if}

{!-- and if you still need to output something even if not plhotel, just use an if:else and repeat your structure --}

{/matrix_field}

I don't have a particular playa/matrix set up in mind I can test the possible parse issues in, so give it a whirl.

1
  • Thanks for the reply. When I move the {exp:playa…} tags just out to just inside of the matrix field tags, it renders nothing. I had tried this once before but ran it again just so I could accurately describe the outcome. So it not only doesn't display it's children it also doesn't display any of the successive matrix tag content… I guess that would be considered a parse issue. (still new to EE) I've also tried a few more variations of your suggestion but pushing the playa tags out seems to always result in disrupting any following matrix info.
    – visyoual
    Feb 4, 2016 at 20:02

Your Answer

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

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