i have a complex situation where a block is not being rendered, and I'm becoming crazy trying to figure out why. If someone can help, I'll be very grateful.
I'm going to simplify it a lot.
I execute this code:
switch($action) {
case "add":
include_once("add.php");
break;
}
$app["TBS"]->MergeField("action","$action")
|
where "add.php" is
$sql="select * from categories order by name";
$rs=$app["db_".$app["name"]]->query($sql);
sqlError($rs,$sql);
$categories=fetchAllAssoc($rs);
$app["TBS"]->MergeBlock("bCategories",$categories);
|
At the end, $category contains
Array
(
[0] => Array
(
[id] => 2
[name] => Abbigliamento
[avgvalue] => 0
[id_creator] => 1
[created] => 2016-09-14 07:06:48
)
[1] => Array
(
[id] => 1
[name] => Cibo e Bevande
[avgvalue] => 0
[id_creator] => 1
[created] => 2016-09-14 07:05:16
)
)
|
Then I load a template like that
<h2>Gestione Beni</h2>
[onshow;file=/home/pwrs/powers.money/templates/pwrs/goods/add.htm;when action='add']
|
than calls a subtemplate like that
<h3>Aggiungi Bene</h3>
<form id="mainform" action="/pwrs/goods/add/" method="post">
<input type="hidden" name="db" value="1">
<div class="form-group">
<label for="id_category">Categoria</label>
<select class="form-control" id="id_category" name="id_category">
<option value="[bCategories.id;block=option]">[bCategories.name]</option>
</select>
</div>
more html
</form>
|
But instead of having the content of $categories replaced in the block, I get the TBS directives printed on screen as they are. TBH, it seems no TBS code is replaced. The subtemplate is loaded but not parsed.
What I'm doing wrong?