twig render string

Solutions on MaxInterview for twig render string by the best coders in the world

showing results for - "twig render string"
Nicola
10 Jun 2020
1$twig = new \Twig_Environment(new \Twig_Loader_String());
2$rendered = $twig->render(
3  "Test string template: {{ result }}",
4  array("result" => "Success!")
5);
Hugo
26 Jan 2019
1$twig = clone $this->get('twig');
2$twig->setLoader(new \Twig_Loader_String());
3$rendered = $twig->render(
4  "Test string template: {{ result|humanize }}",
5  array("result" => "mega_success")
6);
7