从应用程序目录导入宏模板
我试图从 app/Resources/views
目录导入一些宏,但 Symfony 似乎找不到模板。
我尝试了以下方法,它们都返回错误无法找到模板
。
{% import '::macros.twig' as macros %}
{% import '/app/Resources/views/macros.twig' as macros %}
{% import '/app/Resources/views/macros.twig' as macros %}
如何从 app/Resources/views
导入宏?
I'm trying to import some macros from the app/Resources/views
directory, but Symfony doesn't seem to find the template.
I tried the following methods, all of them return an error Unable to find template
.
{% import '::macros.twig' as macros %}
{% import '/app/Resources/views/macros.twig' as macros %}
{% import '/app/Resources/views/macros.twig' as macros %}
How can I import macros from app/Resources/views
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想通了。文件名必须具有扩展名
.html.twig
才能正常工作。I figured it out. The file name must have an extension
.html.twig
for this to work.