2

I'm just upgrading a site from EE1 to EE2 and this code is no longer working in EE2:

{exp:channel:entries}
    {matrix}
        {playa}
            {title}
            {matrix}
                {deep_value}
            {/matrix}
        {/playa}
    {/matrix}
{/exp:channel:entries}

{title} displays fine, but the {deep_value} does not. This used to work in EE1, does anyone know of a work around?

3 Answers 3

5

It’s actually just sheer luck that that worked for you in EE1 – there are a lot of variables at play with EE’s parse order, and most of the time that kind of thing won’t work.

You can get it working using Matrix and Playa’s var_prefix parameters, though:

{exp:channel:entries}
    {matrix}
        {playa var_prefix="playafield"}
            {playafield:title}
            {playafield:matrix var_prefix="nested_matrix"}
                {nested_matrix:deep_value}
            {/playafield:matrix}
        {/playa}
    {/matrix}
{/exp:channel:entries}

(You’d probably want to choose more semantic var prefixes than “playafield” and “nested_matrix” but hopefully you get the idea.)

1
  • Thank you very much for the reply and solution. At first it didn't work, but then I remembered that I had installed Matrix & Playa a fair while before attempting this site upgrade, so I downloaded and installed the latest versions and the above solution now works.
    – Maxwell
    Jul 21, 2013 at 23:47
0

A simple work around would be to use an embed and pass the associated entry id through to that. It's probably not the most efficient method, but it should avoid the issue with nesting a mat

e.g.

=== display.html ===

{exp:channel:entries}
    {matrix}
        {playa}
           {embed="embeds/deepinfo" entry_id="{entry_id}"
        {/playa}
    {/matrix}
{/exp:channel:entries}

=== embeds/deepinfo.html ===

{exp:channel:entries entry_id="{embed:entry_id}"}
    {title}
    {matrix}
        {deep_value}
    {/matrix}
{/exp:channel:entries}
1
  • Thanks very much for the suggestion. I did assume an embed would solve the issue, but I really want to keep the embeds to a minimum as I already have a lot going on in these templates.
    – Maxwell
    Jul 21, 2013 at 23:49
0

I'm sorry for not putting my answer here. I have already posted my answer on similar question. Here is the link to ANSWER

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.