/**
* Parse a template, replacing keywords by values
*
* Values are given in a associativ array which keys are use to replace keywords
* in the template where they are wrap with percent signs. For example, with
* the template :
%title%
- given the array :
- ['title' => 'My beautiful title']
- we get :
My beautiful title
- @param string $template the template
- @param array $data the data to put in the table
- @return type.
*/
static function parseTemplate($template,array $data) {
$data4template = [];
foreach ($data as $k => $v) {
$data4template['%'.$k.'%'] = $v;} $result = str_replace(array_keys($data4template),$data4template,$template); return $result; }