Based upon smarty documentation I should be able to do something like this


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.

1 Answer 1


The civi provided modifier has a different name: crmNumberFormat

moreover as per Paul-Tahoe 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}
  • 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}
    – Paul-Tahoe
    Commented Jan 21, 2016 at 17:08
  • aah good point, I'm fixing the answer, thanks!
    – Xavier
    Commented Jan 21, 2016 at 17:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.