Symfony2.2 render ESI template

2019-04-13 08:13发布

From the documentation, there is no example of how to render a template inside template using ESI. Is it possible to do that?

For example, I have a template index.html.php and I want to render form.html.php template with ESI. How to do that?

1条回答
冷血范
2楼-- · 2019-04-13 09:13

As the documentation page you provided, you can render one controller within another using:

{{ render_esi(controller('YourBundle:Default:news', { 'max': 5 })) }}

You can also use a route name instead of the controller reference:

{{ render_esi(url('latest_news', { 'max': 5 })) }}

However, you will need to set up a gateway cache for ESI to work.

查看更多
登录 后发表回答