doumei9589 2014-07-16 14:25
浏览 110
已采纳

Twig文件路径问题和扩展模板

So I'm trying to extend a layout, and I have the directory structure as such: ../src/views/base.html.twig.

I'm using the code examples right from the documentation, but I have some issue with the file path that I just can't resolve.

In a child template in the same folder named layout.html.twig, I have {% extends "base.html.twig" %}, but it doesn't do anything. I've tried every possible path combination, but nothing works.

Any help?

  • 写回答

1条回答 默认 最新

  • dongsi2317 2014-07-16 14:35
    关注

    The instructions on that page are for the standalone engine as opposed to as part of the Symfony Framework. For info on the Framework version see http://symfony.com/doc/current/book/templating.html#template-inheritance-and-layouts.

    If it is in app/Resources/views/ then you should use ::base.html.twig.

    If it is in a bundle like Acme\RandomBundle then you should use AcmeRandomBundle::base.html.twig.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?