Symfony2.2渲染ESI模板 [英] Symfony2.2 render ESI template
本文介绍了Symfony2.2渲染ESI模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
从文档中可以找到没有如何使用ESI在模板内部呈现模板的示例.可以这样做吗?
From the documentation, there is no example of how to render a template inside template using ESI. Is it possible to do that?
例如,我有一个模板index.html.php
,我想用ESI渲染form.html.php
模板.该怎么做?
For example, I have a template index.html.php
and I want to render form.html.php
template with ESI. How to do that?
推荐答案
作为您提供的文档页面,您可以使用以下方法在另一个控制器中呈现一个控制器:
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 })) }}
但是,您将需要设置网关缓存以使ESI正常工作.
However, you will need to set up a gateway cache for ESI to work.
这篇关于Symfony2.2渲染ESI模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文