<?php
require ('../tplTemplatez.php');
// array with data
$array = array(
array('value' => 'value1', 'caption' => 'caption1'),
array('value' => 'value2', 'caption' => 'caption2'),
array('value' => 'value3', 'caption' => 'caption3'),
);
// load template
$tpl = new tplTemplatez('dinamic.tpl');
$tpl->tplAssign('title', 'Form from template'); // assignin value for title
// parsing for checkbox block
foreach ($array as $k => $v) {
$tpl->tplParse($v, 'row_checkbox');
}
// parsing for select block
foreach ($array as $k => $v) {
$tpl->tplParse($v, 'row_select');
}
$tpl->tplParse(); // parsing for all, because we have some vars (} they don't belong any block
$tpl->tplPrint(); // print the result
//echo "<pre>"; print_r($_POST); echo "</pre>";
?>
|