开发者

Location of template rendering in Symfony2

开发者 https://www.devze.com 2023-03-20 05:19 出处:网络
Where in Symfony2 is template rendering launched? I am asking for the most general class/method handling the template logic, I guess by launching the configured template engine, like Twig 开发者_运维

Where in Symfony2 is template rendering launched?

I am asking for the most general class/method handling the template logic, I guess by launching the configured template engine, like Twig 开发者_运维技巧for example.

Or to put the question even more concretely ... a controller delegates the layout to a specific template, like example.html.twig ... where is this filename used and passed for the first time?


In the most general case, assuming you're using the FrameworkBundle (if you're using Standard Edition, you are), the render function just calls $this->container->get('templating')->renderResponse, just passing along the parameters.

Engines (like the twig engine) implement Symfony\Component\Templating\EngineInterface.

You can check out vendor/symfony/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php (and the other relevant files, like the ones in the TwigBundle), if you'd like to take a close look at how it works.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号