donglong7338 2017-05-03 06:37
浏览 78
已采纳

无法找到模板Symfony 3

After some template renaming mystery happens – twig looking for wrong template and did not find it even it really exists:

Unable to find template "form/bootstrap_3_horizontal_layout.html.twig" (looked into: /home/travel/www/gai/app/Resources/views, /home/travel/www/gai/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Resources/views/Form).

Symfony debugger points to error at line 31:

  30      {% form_theme edit_form 'form/bootstrap_3_horizontal_numbers.html.twig' %}
  31      {{ form_start(edit_form) }}
  32      <div class="box-body">
  33          {{ form_widget(edit_form) }}
  34      </div>

However as you may notice it fails to find theme *layout.html.twig not the *numbers.html.twig.

You may say it may be some issue with caching? It may be but I cleared it as well as know how to: php bin/console cache:clear, rm -rf app/cache. Will be appreciate ideas about what I'm missing. Thank you.

EDIT:

Here is output of ls -la app/Resources/views/form/

drwxrwxr-x  2 travel travel 4096 Geg  3 08:56 .
drwxrwxr-x 11 travel travel 4096 Bal 23 23:47 ..
-rw-rw-r--  1 travel travel 2399 Geg  3 08:56 bootstrap_3_horizontal_layout.html
-rw-rw-r--  1 travel travel 2577 Geg  3 00:22 bootstrap_3_horizontal_numbers.html.twig
-rw-rw-r--  1 travel travel 9668 Kov 19 10:20 bootstrap_3_layout.html.twig
  • 写回答

2条回答 默认 最新

  • dqsp60748 2017-05-03 07:13
    关注

    After reading the output of ls -la the most obviously reason should be that your *layout.html file is missing the .twig ending in the filename.

    Error message:

    Unable to find template "form/bootstrap_3_horizontal_layout.html.twig"

    Filename:

    form/bootstrap_3_horizontal_layout.html

    Change Filename to:

    form/bootstrap_3_horizontal_layout.html.twig

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
  • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序
  • ¥15 onvif+openssl,vs2022编译openssl64
  • ¥15 iOS 自定义输入法-第三方输入法
  • ¥15 很想要一个很好的答案或提示