Categories > TinyButStrong general >

Loading a file with a conditional

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Billy
Date: 2007-05-26
Time: 05:39

Loading a file with a conditional

I'm trying to load a file if a variable is set with no success. What I'm doing wrong?

I have tried these:

[onload;file='include.html';if [var.variable]=1]
[onload;file='include.html';when [var.variable]=1]
[onload_test;file='include.html';when [var.variable]=1]
By: Skrol29
Date: 2007-05-26
Time: 13:05

Re: Loading a file with a conditional

Hi,

Parameter "when" is ignored if there is no parameter "block" in the same TBS tag.

[onload;file='include.html';if [var.variable]=1]
This seems correct to me.
By: Billy
Date: 2007-05-26
Time: 18:08

Re: Loading a file with a conditional

Yeah, seems correct to me too. That was the one I was trying until I saw that the [onload;file=''] example was in the blocks section, so I also tried using the "when" conditional.

Anyway, I tried this and didn't work:

require_once("tbs_class.php");

$test = 0;

$tbs = new clsTinyButStrong;
$tbs->LoadTemplate("tbs.html");
$tbs->Show();
test value: [var.test]<br />
including file: [onload;file='tbs_include.html';if [var.test]=1]
By: Skrol29
Date: 2007-05-26
Time: 19:02

Re: Loading a file with a conditional

Yes, you're right, parameter "if" doesn't affect the parameter "file".

This should work:
[onload;file=[var.test;if [val]=1;then 'tbs_include.html';else '']]
By: Billy
Date: 2007-05-26
Time: 19:11

Re: Loading a file with a conditional

Thanks for the quick reply, that indeed works!