'Hello {{ name }}!' ))); $source = $twig->compile('template'); echo $source;
setTemplateDir('templates'); $smarty->assign('name', 'World'); echo $smarty->fetch('hello.tpl');This code sets up a Smarty object, assigns a variable "name" with the value "World", and then calls the _parse_body function (fetch in this case) to parse the "hello.tpl" template and output the result. In general, different PHP template libraries will have their own implementation of _parse_body, but the goal is always the same: to parse a given template and return the resulting output.