symfony2 - twig - how to render a twig template from inside a twig template
Symfony 2.1:
{% render 'YourBundle:YourController:yourAction' with {'var': value} %}
Symfony 2.6+:
{{ render(controller('YourBundle:YourController:yourAction', {'var': value})) }}
And, of course, read the documentation.
I think some parts are depricated here.To make the include work in latest Symfony 3.1.10, I solved it like this:
{% extends 'base.html.twig' %}{% block body %} {{ include('AppBundle:Default:inner_content.html.twig') }}{% endblock %}
Note: include() with parentheses.Then all the variables are included from the parent template. If you like to restrict some variables in the child template, you use with ... only (look over)