The template file (path given by $file_name) contains the pattern (* <var> [<format>] *) for each area to be substituted.
Any section in REPEAT tags will be iterated for each row in the $data variable.
The <format> area defines how to display the data, by using either sprintf or number_format (or nothing if not defined).
For example (* something %03.2f *) where something = 12.334 would be displayed as 012.33.
and (* data #.2 *) would be displayed as 12.33.
The patterns (* ~ *) and (* + *) are special cases. The former is a toggle, and the latter is a counter.
Refer to test.php to see it in action.