Categories > TinyButStrong general >

Merge fields and subtemplates and special functions

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Reinier van Loon
Date: 2004-06-07
Time: 15:54

Merge fields and subtemplates and special functions

Hi,

I am experiencing a situation where fields are not merged. E.g. output is '[lbl.Ferienwohnung]' where I expected 'vakantiewoning'. I have a function lbl($name,$parmlist) and debugging shows this function is called and returns 'vakantiewoning'. But still the value does not popup. The field is in a subtemplate. I debugged tbs_Locator_Replace but did not get any further.

So, anyone an idea?

Cheers, Reinier
By: Reinier van Loon
Date: 2004-06-07
Time: 17:52

Re: Merge fields and subtemplates and special functions

It turned out to be the combination of include.onshow and merge field functions. The following code
$clsTinyButStrong->loadTemplate('../_template/eifelwelt.html');
$clsTinyButStrong->MergeField('msg','msg',true);
$clsTinyButStrong->MergeField('lbl','lbl',true);
does not work if a subtemplate is included with include.onshow. If you use include.onload all works fine.

So, how can we use include.onshow and merge field functions?
By: Skrol29
Date: 2004-06-08
Time: 02:39

Re: Merge fields and subtemplates and special functions

Hi,

>So, how can we use include.onshow and merge field functions?

Hmmm.... You can use $TBS->Rend to avoid echo and exit after the [var.*] merge. Then you can use $TBS->MergeField() after $TBS->Show().

But the solution I prefere is another one.
As I understand, you don't want to merge the sub-template at the Load, neither at the Show(), but between them.
That's possible. Parameters 'file' and 'script' both work on any TBS tag.
So, you can create one or several personal tags like:
  [subtpl;file='[var.sub_template_1]']
and then merge it (or them) with MergeField, like this:
  $TBS->MergeField('subtpl','');

Enjoy,