Symfony为hinclude配置Twig模板

时间:2015-04-01 13:24:47

标签: symfony templates

我试图服从http://symfony.com/doc/current/book/templating.html#asynchronous-content-with-hinclude-js来设置包含但我没有得到hinclude.html.twig的内容,而是显示“::hinclude.html.twig”。

/app/config/config.yml我有:

templating:
    engines: ['twig']
    hinclude_default_template: "::hinclude.html.twig"

hinclude.html.twig位于/app/Ressources/views/default/hinclude.html.twig,只不过是:

Loading....

实际内容由hinclude.js正确加载,但不是显示Loading...,而是只显示配置文件中的模板路径:::hinclude.twig.html

这些配置也不起作用:

hinclude_default_template: ::hinclude.html.twig
hinclude_default_template: "hinclude.html.twig"
hinclude_default_template: hinclude.html.twig

如何使用Twig模板?

谢谢!

1 个答案:

答案 0 :(得分:1)

它认为是一个错误的配置...

这不起作用:

hinclude_default_template: "::hinclude.html.twig"
hinclude_default_template: ":Default:hinclude.html.twig"

这确实有效:

hinclude_default_template: ":default:hinclude.html.twig"

您需要使用小写“默认”。