0

I would like to use a conditional to hide or show information from an entry. The following code is pulling in data from an EE relationship field. If there is no entry I would like this code NOT to show. I have tried to use {if}{/if} statements, but cannot work the code out!

<h4>{manufacturer_profile:title}</h4>   
<p>{manufacturer_profile:manufacturer_summary}</p>

Would really appreciate some help on this.

6
  • Reading th docs, if there is no relationship your code shouldn't show. What EE version are u using ? Mar 3, 2014 at 11:17
  • @stuartmcd69 I'm using the latest full version of EE. Mar 3, 2014 at 11:18
  • @stuartmcd69 I am using this code and it works: {if "{manufacturer_profile:count}" == ""} {if:else} <h4>{manufacturer_profile:title}</h4> <p>{manufacturer_profile:manufacturer_summary}</p> {/if} Just wonder if there is a better way? Mar 3, 2014 at 11:19
  • Change {if "{manufacturer_profile:count}" == ""} to {if "{manufacturer_profile:count}" != ""} and leave off the {if:else} Mar 3, 2014 at 16:43
  • @JohnathanWaters Thank you so much, so easy now. That worked just as I wanted. Mar 3, 2014 at 21:50

1 Answer 1

1

Just use a variable pair:

{manufacturer_profile}
    <h4>{manufacturer_profile:title}</h4>   
    <p>{manufacturer_profile:manufacturer_summary}</p>
{/manufacturer_profile}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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