1

I am rendering a PHP template with Symfony 2, the template code I have:

phptemplate.html.php:

...
<?php echo $view->render('MyBundle:Def:info.html.twig', array('m' => $m)) ?>
...

MyBundle:Def:info.html.twig:

abc
{{ url('form_individual') }}
{{ m.test }}
abc

Output display result:

abc
{{ url('form_individual') }}
{{ m.test }}
abc

Variables are not rendered but instead are displayed as text, why?

6
  • did you have defined the doctype ? Also what is test ? If it's a block, then you've defined it incorrectly. Commented Feb 23, 2014 at 11:17
  • i replace test to abc - this is nothink its string rendered on page. Where i defined doctype ? Commented Feb 23, 2014 at 11:33
  • other twig templates not rendered in php template work without problems Commented Feb 23, 2014 at 11:40
  • $m is object send from phptemplate.html.php Commented Feb 23, 2014 at 13:16
  • echo get_class($view) what do you get? Commented Feb 23, 2014 at 13:29

1 Answer 1

1

PhpEngine, which in fact you used, doesn't support twig templates. So, yourtwigtemplate is (probably) parsed as a plain text.

PhpEngine supports method Source code and here base doc for supports where is: Returns true if this class is able to render the given template..

Why you didn't rewrite your MyBundle:Def:info.html.twig template to php? Or parent one to twig?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.