I am using EE 2.6.1 with a relationship field. The two entries in the venue related entry (telephone and email) are not mandatory fields, so the way I would usually do it is wrap it in an if statement and only display if the field is populated. Like so:

<div class="contact-details">
            {if course-venue:telephone}<p>Telephone: {course-venue:telephone}</p>{/if}
            {if course-venue:venue-email}
                <p>Email: {encode="{course-venue:venue-email}" title="{course-venue:venue-email}"}</p>

Problem is that EE's native relationships field doesn't seem to work this way, does anyone know how I can achieve the same result? This just displays nothing.

Thanks in advance!

up vote 2 down vote accepted

I hate to suggest it, but have you tried:

{if course-venue:telephone != ""}<p>Telephone: {course-venue:telephone}</p>{/if}

or alternatively

{if '{course-venue:telephone}' != ""}<p>Telephone: {course-venue:telephone}</p>{/if}

It seems like logically what you tried should work, but I've not used the new native relationship field to try something like this. You do of course have the chunk you included above wrapped in {course-venue} and {/course-venue}, right?

Does it return the right data without the conditional (i.e. for your other related custom fields in the related entry)?

  • I hadn't tried those. Your first suggestion didn't work but the second did. Also so does {if '{course-venue:telephone}'} - so thank you very much! Will accept this as the answer when the StackExchange allows me to! – Joe Beaver Aug 22 '13 at 15:34
  • It's unfortunate that it needed that revision - the result is a complex conditional, which isn't ideal for performance, but if it works, it works. Glad I could help. – Jean St-Amand Aug 22 '13 at 15:42
  • @JeanSt-Amand, there isn't simple or advanced conditionals using modules variables. Simple conditionals are parsed before the modules and the advanced are parsed after them. Conditionals using tags or values of modules are always parsed after them or by its own parser. – Robson Sobral Aug 25 '13 at 17:23

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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