Symfony 为 hinclude 配置 Twig 模板
Symfony configure Twig template for hinclude
我试图按照 http://symfony.com/doc/current/book/templating.html#asynchronous-content-with-hinclude-js 设置 hinclude,但我没有得到 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 模板?
谢谢!
发现是配置错误...
这行不通:
hinclude_default_template: "::hinclude.html.twig"
hinclude_default_template: ":Default:hinclude.html.twig"
这确实有效:
hinclude_default_template: ":default:hinclude.html.twig"
您需要使用小写"default"。
我试图按照 http://symfony.com/doc/current/book/templating.html#asynchronous-content-with-hinclude-js 设置 hinclude,但我没有得到 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 模板?
谢谢!
发现是配置错误...
这行不通:
hinclude_default_template: "::hinclude.html.twig"
hinclude_default_template: ":Default:hinclude.html.twig"
这确实有效:
hinclude_default_template: ":default:hinclude.html.twig"
您需要使用小写"default"。