I'm trying to make use of html templates in my project and it's working so far but to make the templates easier to use I would like to use {} to denote the field areas. Like this:
//tplCall.html
<div id="{CustID}">
<div class="callname">{Name}</div>
<div class="calladdress">{Address}</div>
</div>
The following works fine:
$tmpCall = file_get_contents("templates/tplCall.html");
$tmpdata = get_object_vars($thiscall);
$htmlout = str_replace(array_keys($tmpdata),array_values($tmpdata),$tmpCall);
echo $htmlout;
But obviously leaves the {} intact. I would like to do something like the following but I get an array to string error. How can I add the {} to the key portion before it gets sent to str_replace?
$tmpCall = file_get_contents("templates/tplCall.html");
$tmpdata = get_object_vars($thiscall);
$htmlout = str_replace("{" . array_keys($tmpdata) . "}",array_values($tmpdata),$tmpCall);
echo $htmlout;