TinyButStrong - the PHP Template Engine
Categories > TinyButStrong general >

Using class method as MergeField function

By: Fabrizio Lodi
Date: 2017-02-06
Time: 16:39

Using class method as MergeField function

I'm trying to do something like

MergeField('tokens','this->getString',true);

But it is not working. It is even possible? How can I do that? Using Array($this,'getString') as in array_walk?

Or using a variable, like

$f=$this->getString;
$tbs->MergeField('tokens','f',true);

Please !!!
By: Skrol29
Date: 2017-02-06
Time: 23:22

Re: Using class method as MergeField function

Hi,

Here the solution for now:
$tbs->ObjectRef['my_obj'] = $this;
$tbs->MergeField('tokens', '~my_obj.getString', true);
By: Fabrizio Lodi
Date: 2017-02-07
Time: 10:29

Re: Using class method as MergeField function

Thank you!!!!