I've got a weird issue with parentheses in an if statement. If I have the if statement on it's own then no content is shown. If, however, I place two if statements in front of it then everything works fine. See examples below:


{if downloads:total_rows >= '1'}{/if}
{if section_1:total_rows == '1'}{/if}
{if (downloads:total_rows >= '1' || section_2:total_rows == '1') && section_1:total_rows == '1'}
    Content ...

Does not work

{if (downloads:total_rows >= '1' || section_2:total_rows == '1') && section_1:total_rows == '1'}
    Content ...

Does anyone know why this strange behaviour is occurring?

Thank you.


I would try putting your variables in curly braces:

{if ({downloads:total_rows} > 0 || {section_2:total_rows} == 1) && {section_1:total_rows} == 1}
    Content ...

You are making this an advanced conditional so you can't access your variables correctly in the conditional without the braces. I tested the code above and it works for me.


  • For some reason this is now throwing up an error: Parse error: syntax error, unexpected '{' in... Edit: Just noticed that there is a closing curly brace rather than bracket but the error is still appearing. Jul 14 '14 at 9:45
  • I made edits to the source in my answer Jul 14 '14 at 10:52
  • So is it still throwing a syntax error? Jul 14 '14 at 10:53
  • Unfortunately so, although it's complaining about the operator now: Parse error: syntax error, unexpected '>' in... Jul 14 '14 at 11:04
  • Are the numbers you are comparing with in quotes or not? Jul 14 '14 at 11:18

It seems as though the conditions inside the parentheses don't need the curly braces. At least this has fixed it for me.

{if (downloads:total_rows > 0 || section_2:total_rows == 1) && {section_1:total_rows} == 1}
  • You're still bracing section_1:total_rows, is that intentional? Jul 15 '14 at 23:04
  • It is intentional however the reason why is confusing me. If I remove the braces then the content does not show, if they're there the content does show. I'm not fully understanding why this is. Jul 16 '14 at 9:45
  • 1
    Might try 2.9.0 :) Jul 16 '14 at 14:34

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.