By: Trent
Date: 2007-01-13
Time: 22:30
|
Functions & TBSOkay, I have a function that formats Networth (cash value) of a player into the following format: 10,000 = 10 K, 1,000,000 = 1 M, etc.
Here is the function:
Now I'm trying to call this via TBS within my template.
And here is my HTML for displaying the information:
Networth is a field in my db that contains the value that I want to format. For example, let's say that the networth is 1,250,000, then what should be displayed when the template loads is 1.25 M, but it's displaying as 1250000. Should I just do a separate call to my db outside of TBS and format the information the way I want it and place it into an array and then use TBS to process the array data? Or is there a way to make the onformat function work the way I'm wanting? Thanks in advance. |
|||
By: Skrol29
Date: 2007-01-15
Time: 19:00
|
Re: Functions & TBSHi,
The fmtnum() function must have a convenient declaration to works with parameter ondata. The value must not be returned but stored into an argument. The expected syntax is here: http://www.tinybutstrong.com/manual.php#html_field_prm_onformat |