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 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b