1

Having an issue placing playa inside a URL segment conditional. Inside the conditional, playa doesn't return entries, though if I substitute the playa call with simple text, the conditional works. And strangely, if I have a blank {if:else} statement, the playa entries will show.

Any ideas?

Doesn't work:

{exp:channel:entries channel="my-channel" limit="1"}
   {if segment_3 == "{entry_id}" }

        {exp:playa:children field="my-channel-field"}
            <li><a href="#">{title} - {other-field}</a></li>
        {/exp:playa:children}

   {/if}
{/exp:channel:entries}

Works:

{if segment_3 == "{entry_id}" }
  Nice id!
 {if:else}
  Sorry, underage!
{/if}

Also works:

   {if segment_3 == "{entry_id}" }
        {exp:playa:children field="my-channel-field"}
            <li><a href="#">{title} - {other-field}</a></li>
        {/exp:playa:children}
    {if:else}
   {/if}
2
  • what is difference between first and third code block as both seems same except if:else. Commented Apr 26, 2013 at 4:30
  • The last two examples are complex conditionals, while the first one is a simple conditional. The parse order is different, as simple conditionals get parsed before modules and plugin tags. See here: loweblog.com/downloads/ee-parse-order.pdf Commented Apr 26, 2013 at 12:27

1 Answer 1

1

The difference may be due to the parsing order. The 1st block in your example is a simple conditional, vs the advanced conditional in the 3rd block. So the time the conditional is parsed is later with the advanced. What if you try adding parse="inward" to your first example:

{exp:channel:entries channel="my-channel" limit="1" parse="inward"}
2
  • Ah, yes, probably the parse order. Parse inward unfortunately did not do the trick. Would this be a job for switchee? Commented Apr 26, 2013 at 15:12
  • That sounds like the add-on to try! Commented Apr 26, 2013 at 15:15

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.