Categories > TinyButStrong general >

Field if-then-else won't work

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Martin
Date: 2007-06-22
Time: 20:09

Field if-then-else won't work

Hi,

the following field is not merged as expected, although it seems to me just as in the manual:

[var.grade1;if[val]!='good';then 'not so good';else 'really good']

Here is the php that goes with it:

include_once('tbs/tbs_class.php');
$grade1 = "good";
$TBS =& new clsTinyButStrong;
$TBS->LoadTemplate('zeugnis/test.html');
$TBS->MergeField('var');
$TBS->Show(TBS_NOTHING);
$result = $TBS->Source;
$fp = fopen("zeugnis/test_modified.html","w");
fputs($fp, $result);
fclose($fp);
echo $result;

As I understand the manual, the show method does not merge fields with "if-parameters" so I'm trying to do it by calling MergeField('var') before.

Any help is very welcome.

Martin
By: Skrol29
Date: 2007-06-22
Time: 22:04

Re: Field if-then-else won't work

Hi,

There should be a space between "if" and "[val]".
By: Martin
Date: 2007-06-22
Time: 23:00

Re: Field if-then-else won't work

Thanks Skrol29,

I would never found that out. Many thanks indeed.
Maybe I will modify the tbs class so that it will work without the space, too.

Martin