Components
Complex GUIs are created with components. A component can reduces the effort dedicated in the production. Create a component with Div and for Div, is a very simple mechanism to implement. See the next example:
combobox.tpl
<select id="{$id}" name="{$name}">
[${$options}]
<option value="{$val}">{$text}</option>
[/${$options}]
</select>
This component use: simple replacements, lists and recursion.
index.php
<?php
echo new div('index.tpl', [
'products' => [
['val' => 1, 'text' => 'Banana'],
['val' => 2, 'text' => 'Potato'],
['val' => 3, 'text' => 'Apple']
]
]);
<select id="products" name="products">
<option value="1">Banana</option>
<option value="2">Potato</option>
<option value="3">Apple</option>
</select>