ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Formatting of conditionals, missing space throws 'syntax error, unexpected T_ENDIF'

April 19, 2011 7:32am

Subscribe [3]
  • #1 / Apr 19, 2011 7:32am

    I have been breaking up my conditionals this way (to learn why read this post and this post)

    The following two examples will throw a syntax error, unexpected T_ENDIF

    {if things != "this_condition"}{if things != "another_condition"}
          {exp:channel:entries}
              {content}
         {/exp:channel:entries}
    {/if}{/if}
    {if things != "this_condition"}
         {content}
    {/if}{if things != "another_condition"}
         {content}
    {/if}

    This can be corrected by adding spaces between conditionals. Per these examples:

    {if things != "this_condition"} {if things != "another_condition"}
          {exp:channel:entries}
              {content}
         {/exp:channel:entries}
    {/if} {/if}
    {if things != "this_condition"}
         {content}
    {/if} {if things != "another_condition"}
         {content}
    {/if}
  • #2 / Apr 19, 2011 6:49pm

    Greg Salt

    3988 posts

    Hi Hendrik,

    That error should not be shown if you have your tags formatted as in your first example. Which version and build of EE are you using in your installation?

    Cheers

    Greg

  • #3 / Apr 20, 2011 8:07am

    EE 2.1.3 Build: 20101220

  • #4 / Apr 20, 2011 6:02pm

    Sue Crocker

    26054 posts

    Hi, Hendrik-Jan.

    I tried this code (using title since I didn’t have the same fields) and no errors. This was on the 20110411 build and EE214 beta. I also did this in a stand alone template. How about you?

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases