I have a fluid field that contains a field group which in turn contains a grid field. I’m trying to show markup conditionally in the template, only when the grid field is populated:
{my_fluid} {my_fluid:my_group} {fields}{my_group:my_grid}{content}{if '{content:total_rows}’ != ‘0’}Show stuff{/if}{/content}{/my_group:my_grid}{/fields} {/my_group:my_fluid} {/my_fluid}
This works perfectly when the grid field has rows, but when it’s left empty for some reason it renders only the {/content} tag on the front end.
Here’s where it gets really weird: if the template has a space between the {fields} tag and {my_group:my_grid} then it works! The conditional content is shown when the grid has rows, and the rogue {/content} tag disappears:
{my_fluid} {my_fluid:my_group} {fields}SPACE HERE{my_group:my_grid}{content}{if '{content:total_rows}’ != ‘0’}Show stuff{/if}{/content}{/my_group:my_grid}{/fields} {/my_group:my_fluid} {/my_fluid}
Note: all of this happens regardless of what I try to show conditionally.
Any idea what’s up here?
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.