Answers.Body: <p>The civi provided modifier has a different name: crmNumberFormat</p>
  
  <p>moreover as per Paul-Tahoe analysis, smarty seems to be confused, so the trick is to assign the formatted value to a temporary variable:</p>
  
  <pre><code>{assign var="ttl" value=$contact.total_amount|crmNumberFormat:2:'.':','}
  
  and then display it:{$ttl}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-21T17:08:17.090Z
Answers.Text: After a fashion it works.  It doesn't work in place like shown. It throws a "syntax error: unrecognized tag:" 
  
  I had to assign it to a var.  {assign var="ttl" value=$contact.total_amount|crmNumberFormat:2:'.':','}Total Amount:{$ttl}
Answers.UserDisplayName: Paul-Tahoe
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-21T17:19:28.640Z
Answers.Text: aah good point, I'm fixing the answer, thanks!
Answers.UserDisplayName: Xavier
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-21T09:44:03.223Z
Answers.LastActivityDate: 2016-01-21T17:21:46.433Z
Answers.LastEditDate: 2016-01-21T17:21:46.433Z
Answers.UserDisplayName: Xavier
Body: <p>Based upon smarty documentation I should be able to do something like this</p>
  
  <pre><code>{contribution.total_amount|number_format:2:".":","}
  </code></pre>
  
  <p>and get something like 1,234.56, but it shows blank.  In the logs I see:</p>
  
  <pre><code>[plugin] (secure mode) modifier 'number_format' is not allowed 
  (core.load_plugins.php, line 118) in Smarty-&gt;trigger_error() (line 1094 
  of  .../sites/all/modules/civicrm/packages/Smarty/Smarty.class.php).
  </code></pre>
  
  <p>In searching our code tree a bit, I find a plugin modifier.crmNumberFormat.php, which looks like it should be the one. So why isn't it using it?</p>
  
  <p>I do see that there are two Smarty plugin directories.  Not sure which one it's using.  There is one in sites/all/modules/civicrm/packages/Smarty and another in sites/all/modules/civicrm/CRM/Core/Smarty</p>
  
  <p>We're running 4.5.8 and have 4.6.7 in a dev environment.</p>
  
Tags: <smarty>
Title: Can I format a smarty token number to have thousands comma?
ThreadText: # Can I format a smarty token number to have thousands comma?
  
  (Asked by: username_0 on 2016-01-21)
  
  Based upon smarty documentation I should be able to do something like this
  
  ```
  {contribution.total_amount|number_format:2:".":","}
  
  ```
  
  and get something like 1,234.56, but it shows blank. In the logs I see:
  
  ```
  [plugin] (secure mode) modifier 'number_format' is not allowed 
  (core.load_plugins.php, line 118) in Smarty->trigger_error() (line 1094 
  of  .../sites/all/modules/civicrm/packages/Smarty/Smarty.class.php).
  
  ```
  
  In searching our code tree a bit, I find a plugin modifier.crmNumberFormat.php, which looks like it should be the one. So why isn't it using it?
  
  I do see that there are two Smarty plugin directories. Not sure which one it's using. There is one in sites/all/modules/civicrm/packages/Smarty and another in sites/all/modules/civicrm/CRM/Core/Smarty
  
  We're running 4.5.8 and have 4.6.7 in a dev environment.
  
  **Tags:** smarty
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-01-21. Score: 5
  
  The civi provided modifier has a different name: crmNumberFormat
  
  moreover as per username_0 analysis, smarty seems to be confused, so the trick is to assign the formatted value to a temporary variable:
  
  ```
  {assign var="ttl" value=$contact.total_amount|crmNumberFormat:2:'.':','}
  
  and then display it:{$ttl}
  
  ```
  
  > **Comments:**
  > **username_0**: After a fashion it works.  It doesn't work in place like shown. It throws a "syntax error: unrecognized tag:"   I had to assign it to a var.  {assign var="ttl" value=$contact.total_amount|crmNumberFormat:2:'.':','}Total Amount:{$ttl}  
  > **username_1**: aah good point, I'm fixing the answer, thanks!  
  
  ---
  
  