Frederik Ramm wrote:
Dear List,
I have a variable given in Cents and I want to print it out in
Dollars. I know that I can write a filter routine in Perl but I would
prefer to do it all in the template. I tried this:
[%- USE format -%]
[%- dollars = format('%.2f') -%]
...
[% dollars(amount/100) %]
but obviously the "amount/100" is not allowed as the argument to
dollars(). What's a good way to do it?
That's just a bit of pickiness in the TT parser. You sometimes need to
nurse it a bit.
[%- USE format -%]
[%- dollars = format('%.2f') -%]
[%- amount = 1999 -%]
...
[% doll_amt = amount / 100; dollars(doll_amt) %]
Dave...
_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates