Skip to content

Commit 6c3be63

Browse files
authored
Merge pull request #631 from ExpressionEngine/bug/7.x/advanced-conditional-braces-needed
added additional info on when braces are required in conditionals
2 parents d3fd71d + e0e5768 commit 6c3be63

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

docs/templates/conditionals.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,21 @@ Tags that output numeric content will work fine with quotes, but also do not nee
281281

282282
{if {fluid_content:count type="long_form_text"} == 3}
283283

284+
If the conditional expression contains [variable modifiers](templates/variable-modifiers.md), braces should only be omited if the conditional is executed on a top-level variable (not Grid column or Fluid field element) and when there is only one check in the expression (no AND / OR operators).
285+
In other words, you can only do following without braces:
286+
287+
{if grid_field:total_rows}
288+
289+
But you will need braces in there cases:
290+
291+
{if {grid_field:total_rows} AND {another_grid_field:total_rows}}
292+
293+
{if {grid_field:text_column:length}}
294+
295+
{fluid:rte_field}
296+
{if '{content:has_excerpt}' == 'y'}<h1>Read More</h1>{/if}
297+
{/fluid:rte_field}
298+
284299
## Short Conditionals
285300

286301
Certain conditionals exist in a shortened form in order to improve template readability. These conditionals are usually checking to see if a certain thing is true or exists:

0 commit comments

Comments
 (0)