从the documentation开始,没有关于如何使用ESI在模板内呈现模板的示例。有可能吗?
例如,我有一个模板index.html.php
,我想用ESI渲染form.html.php
模板。怎么做?
答案 0 :(得分:4)
作为您提供的文档页面,您可以使用以下内容在另一个控制器中呈现一个控制器:
{{ render_esi(controller('YourBundle:Default:news', { 'max': 5 })) }}
您还可以使用路径名而不是控制器参考:
{{ render_esi(url('latest_news', { 'max': 5 })) }}
但是,您需要为ESI设置gateway cache才能正常工作。