Ben*_*X80 34 symfony twig symfony-2.2
我正在将我的项目从Symfony 2.0.22升级到2.2.0并查看一些更改,但我已被阻止:
我想渲染(如在Sf 2.0.X中)带有控制器的标题,"渲染"树枝方法对我不起作用.他们的错误是:
在"OSSiteBundle:Index:index.html.twig"中呈现模板("找不到"GET索引:标题""的路径")期间抛出异常.
这是实际的渲染方法:
{#src/OS/SiteBundle/Resources/views/layout.html.twig#}
...
{%render"OSSiteBundle:Index:header"with {'thisid':block('thisid'),...}%}
我试过了 :
{{ render('OSSiteBundle:Index:header' , {'thisid' : block('thisid'), 'thistitle' : block('thistitle'), 'thisunderpageid' : block('thisunderpageid'), 'thisbackground' : block('thisbackground') }) }}
{{ include("OSSiteBundle:Index:header.html.twig", {'thisid' : block('thisid'), 'thistitle' : block('thistitle'), 'thisunderpageid' : block('thisunderpageid'), 'thisbackground' : block('thisbackground') }) }}
Run Code Online (Sandbox Code Playgroud)
=>最后一个工作但控制器没有以这种方式进行校对
我甚至试过了一个带有routing.yml路径的渲染......我没有其他想法请帮助我!
Jua*_*osa 87
在Symfony> = 2.2.x中,你应该像这样嵌入你的控制器:
{{ render(controller('AcmeArticleBundle:Article:recentArticles', { 'max': 3 })) }}
Run Code Online (Sandbox Code Playgroud)
看看文档:
| 归档时间: |
|
| 查看次数: |
68521 次 |
| 最近记录: |