0

I need to do a check like this:

{if:elseif {related_entries id="privacy"}{entry_id}{/related_entries} == 48}

However, the template errors out when there is no related entry. How do I do this test properly?

2

After the parsing of the related entry, if there's no related entry, your conditional will became this:

{if:elseif == 48}

As you can see, this doesn't make any sense. So, add quotation marks:

{if:elseif "{related_entries id='privacy'}{entry_id}{/related_entries}" == 48}

After the parsing of the related entry, if there's no related entry, your conditional you became this:

{if:elseif "" == 48}

And it'll work fine.

| improve this answer | |
  • Doh! I was fixated on trying to figure out how to check for NULL. Your answer makes sense. Thanks. – ExpressionEngineNewbie Jul 23 '13 at 15:04

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.