The Problem
I have a very small JSON-RPC service which formats standardised data to a given template, so say I can go
$mycoolservice->jsonToTemplate($myCoolJson, $myCoolTemplate);
But likewise I could also do
$mycoolservice->jsonToTemplate($myCoolJson, $myOtherCoolTemplate);
or indeed
$mycoolservice->xmlToTemplate($myCoolXml, $myCoolTemplate);
and it returns a string, with the data in whatever format translated to the template, also in whatever format. I'd like to use Volt as the template engine, but how do I use it in such a way that I can call it like this (roughly)?
function service ($string, $var1, $var2, $var3) {
$myCoolService->setTemplate($string)
$myCoolService->tom = $var1;
$myCoolService->dick = $var2;
$myCoolService->harry = $var3;
return $myCoolService->render();
}
Naturally, they don't have to be those specific function names, it's indended as sort-of pseudocode
Thanks very much, Phalcon dudes