Q:

twig render string

$twig = new \Twig_Environment(new \Twig_Loader_String());
$rendered = $twig->render(
  "Test string template: {{ result }}",
  array("result" => "Success!")
);
0
$twig = clone $this->get('twig');
$twig->setLoader(new \Twig_Loader_String());
$rendered = $twig->render(
  "Test string template: {{ result|humanize }}",
  array("result" => "mega_success")
);
0

New to Communities?

Join the community