Categories > TinyButStrong general >

Passing format for a field from php code

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Hameed
Date: 2011-06-25
Time: 18:19

Passing format for a field from php code

Hi there,

Is there a way to pass the format of a field to the template from php?

[fld;frm=<format_string_from_php>]

Thanks,
Hameed
By: Skrol29
Date: 2011-06-25
Time: 21:32

Re: Passing format for a field from php code

Only if you can ensure that the format field is merged before data field.

[fld;frm=[onload.my_format]]
By: Hameed
Date: 2011-06-26
Time: 04:30

Re: Passing format for a field from php code

This is very nice. Now I can have a system wide format for my dates and number for all my templates.

Thanks,
Hameed
By: Skrol29
Date: 2011-06-26
Time: 16:14

Re: Passing format for a field from php code

You also may be interested by parameter "tplfrms".
See :
http://www.tinybutstrong.com/manual.php#html_field_prm_tplfrms
By: Hameed
Date: 2011-06-27
Time: 00:51

Re: Passing format for a field from php code

Yes, I have read that earlier.

I use an array to store all formatting stuff and pass it to the template as below:

$tbs->MergeField('f', $formatArray);

Then I can use it in the template as below:

[fld;frm=[f.my_format]]

Hope this approach is correct.