Closed lenybernard closed 10 years ago
I fixed the problem by using the string_loader Twig extension :
$twigEnv = new \Twig_Environment(new \Twig_Loader_String());
$value = $twigEnv->render(
$response
);
More informations here : https://www.techpunch.co.uk/development/render-string-twig-template-symfony2 http://twig.sensiolabs.org/doc/functions/template_from_string.html
Cool!:) Can you provide a Pull-Request? Have you checked if the performance is the same?
I prepare the PR right now. I didn't analyzed the performance but it doesn't looks like different and it's kind of framework native so, I guess contributors makes it for us ;)
Hi Marc,
First of all, thank you for your share. It was exactly what i was seeking for but actually I've got a bug :
I also tried to implement it in my own project and I got this message :
The problem seems to be in the TwigExtension
I'm using Symfony 2.4 so my version of Twig is ~1.11. Did your bundle is compatible with this version or if it's a problem from me ? Thank you