Categories > TinyButStrong general >

Conditional block help

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Asfihani
Date: 2007-01-26
Time: 10:45

Conditional block help

I have the following code:

$stmt = "SELECT * from Customer where id=$id";

include_once("inc/tbs_class.php");
$TBS = new clsTinyButStrong;
$TBS->LoadTemplate("cust.tpl");
$TBS->MergeBlock("blk1",$cnx_id,"$stmt");
$TBS->Show();

File cust.tpl:

<table width="400" border="0" align="center" cellpadding="2" cellspacing="0">
<tr>[onload;block=tr;when [blk1.active]='1']<td width="75">&nbsp; Status</td><td>: &nbsp;Aktive</td></tr>
<tr>[onload;block=tr;when [blk1.active]='2']<td width="75">&nbsp; Status</td><td>: &nbsp;Inactive</td></tr>
<tr bgcolor="#FFFFFF"><td width="75">&nbsp; Name</td><td>: &nbsp;<strong>[blk1.name]</strong></td></tr>

But it only show :

Name: Customer

How do I fix this problem?
By: Skrol29
Date: 2007-01-26
Time: 11:10

Re: Conditional block help

Of course. [blk1.active] is not yet merged when [onload] are processed.

More simple :
<tr><td width="75">&nbsp; Status</td><td>: &nbsp; [blk1.active;if [val]=1;then 'Aktive';else 'Inactive']</td></tr>

By: Asfihani
Date: 2007-01-27
Time: 04:14

Re: Conditional block help

Thank you. It worked.