Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

format modifier howto

Hello,

I need to write

sprintf('%010s', $invoiceFlat->invoiceInc)

in volt. How to use format modifier?



34.6k
edited Oct '14

Hey man

You must to defind function php in volt, for example

[...]
$compiler = $volt->getCompiler();

 $compiler->addFunction('sprintf', 'sprintf');

Also you refer setup function of volt here

It worked! :) Thank you. Here is my example.

{{ ('%0'~society.invoicePad~'s')|format(invoiceFlat.invoiceInc) }}