1
I have a form built using the Template Engine
Dwoo
which has three variables (of data specific to the attributes "name" and "value"),
this form will be inserted multiple times within another template but as the variable name has to be the same as the data array key that is passed in the template invocation, so how will I change the value of these variables to each new form?
Form template code:
<form class="form-inline" role="form" action="#" method="get">
<div class="form-group">
<label for="country">Country</label>
<select class="form-control country" name="country">
<option value="all">All (WorldWide)</option>
</select>
</div>
<div class="form-group">
<button class="btn btn-default" type="submit" name={$search} value={$search}>Search</button>
<button class="btn btn-default" type="submit" name={$save_pdf} value={$save_pdf}>Save in PDF</button>
<button class="btn btn-default" type="submit" name={$save_png} value={$save_png}>Save in PNG</button>
</div>
</form>
Code php that "printa" the template
<?php
session_start();
require_once '../../../vendor/autoload.php';
$dwoo = new Dwoo\Core();
$dwoo->setCompileDir('../../../assets/compiled/');
$dwoo->setTemplateDir('../../../assets/templates/');
$data = array();
if((isset($_SESSION['email']) == true) && (isset($_SESSION['pass']) == true)){
$data['page'] = 'site-statistics.php';
$data['search'] = 'form_1_search';
$data['$save_pdf'] = 'form_1_save_pdf';
$data['$save_png'] = 'form_1_save_png';
$dwoo->output('site-statistics.tpl', $data);
}else{
header('Location:index-admin.php');
}
?>