Answers.Body: <p>I'm not sure these changes would be considered a &quot;new&quot; syntax rather than a stricter enforcement of existing syntax, causing heretofore-unnoticed syntax errors to rear their heads.</p>
  <p>For the first, the string needs to be quoted. Unquoted strings throw a notice at least, or I think an error in later versions of PHP. So it should be:</p>
  <pre><code>{if $type == 'Work'}{$employer}{/if}
  </code></pre>
  <p>For the second, <code>{capture}</code> always captures a string (whatever is inside the <code>{capture}{/capture}</code>) so will never be anything other than a string. You could change your conditional to <code>{if $donor_port != ''}</code>, or simplify it further to <code>{if $donor_port}</code>.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-09-05T16:21:08.230Z
Answers.Text: Thank you @Coleman. Quotes fixed it
Answers.UserDisplayName: CiviTeacher
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-09-05T20:07:38.360Z
Answers.Text: No problem, although looking at it again, the only thing inside your `{capture}` is another token, so why not use that token directly? I don't think capturing it serves any purpose.
Answers.UserDisplayName: Coleman
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-08-30T02:44:20.817Z
Answers.LastActivityDate: 2023-08-30T02:44:20.817Z
Answers.UserDisplayName: Coleman
Body: <p>I am getting two issues after upgrade from 5.58 to 5.63 related to Smarty in message templates.</p>
  <p>In one case, the location_type_id no longer seems to valid.</p>
  <pre><code>{capture assign=type}{contact.address_primary.location_type_id:label}{/capture}   
  {if $type == Work}{$employer}{/if}
  </code></pre>
  <blockquote>
  <p>syntax error: (secure mode) 'Work' not allowed in if statement
  (Smarty_Compiler.class.php, line 1398)</p>
  </blockquote>
  <p>Perplexingly in the other, != NULL does not see to be a valid operator value combination.</p>
  <pre><code>{capture assign=donor_port}{contact.custom_65}{/capture}
  {if $donor_port != NULL}
  Donor Portfolio: {$donor_port}
  {/if}
  </code></pre>
  <blockquote>
  <p>syntax error: (secure mode) 'NULL' not allowed in if statement (Smarty_Compiler.class.php, line 1398)</p>
  </blockquote>
  <p>Any ideas what the replacements for these are, is there <strong>new syntax documentation?</strong></p>
  
Tags: <civimail><smarty>
Title: How to check for address type and NULL with a Smarty token after Smarty changes in 5.63?
ThreadText: # How to check for address type and NULL with a Smarty token after Smarty changes in 5.63?
  
  (Asked by: username_0 on 2023-08-30)
  
  I am getting two issues after upgrade from 5.58 to 5.63 related to Smarty in message templates.
  
  In one case, the location\_type\_id no longer seems to valid.
  
  ```
  {capture assign=type}{contact.address_primary.location_type_id:label}{/capture}   
  {if $type == Work}{$employer}{/if}
  
  ```
  
  > syntax error: (secure mode) 'Work' not allowed in if statement
  > (Smarty\_Compiler.class.php, line 1398)
  
  Perplexingly in the other, != NULL does not see to be a valid operator value combination.
  
  ```
  {capture assign=donor_port}{contact.custom_65}{/capture}
  {if $donor_port != NULL}
  Donor Portfolio: {$donor_port}
  {/if}
  
  ```
  
  > syntax error: (secure mode) 'NULL' not allowed in if statement (Smarty\_Compiler.class.php, line 1398)
  
  Any ideas what the replacements for these are, is there **new syntax documentation?**
  
  **Tags:** civimail, smarty
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2023-08-30. Score: 3 | Accepted answer
  
  I'm not sure these changes would be considered a "new" syntax rather than a stricter enforcement of existing syntax, causing heretofore-unnoticed syntax errors to rear their heads.
  
  For the first, the string needs to be quoted. Unquoted strings throw a notice at least, or I think an error in later versions of PHP. So it should be:
  
  ```
  {if $type == 'Work'}{$employer}{/if}
  
  ```
  
  For the second, `{capture}` always captures a string (whatever is inside the `{capture}{/capture}`) so will never be anything other than a string. You could change your conditional to `{if $donor_port != ''}`, or simplify it further to `{if $donor_port}`.
  
  > **Comments:**
  > **username_0**: Thank you @username_1. Quotes fixed it  
  > **username_1**: No problem, although looking at it again, the only thing inside your `{capture}` is another token, so why not use that token directly? I don't think capturing it serves any purpose.  
  
  ---
  
  