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. Apr 26 '13 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 Apr 26 '13 at 12:27
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?
    – g-nice
    Apr 26 '13 at 15:12
  • That sounds like the add-on to try! Apr 26 '13 at 15:15

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.