【发布时间】:2016-11-16 18:28:41
【问题描述】:
我是twig 的新手。我在 PhpStorm 中使用它并且路径有问题。
这是我的文件夹结构:
- template /folder/
- main.twig
- common /folder/
- bootstrap.twig
- nav.twig
在main.twig我有代码:
{% extends "common/bootstrap.twig" %}
当我 Ctrl + 单击 链接 PhpStorm 会打开正确的文件。
但是在bootstrap.twig我必须写:
{% include "common/nav.twig" %}
然后 Ctrl + 单击 不起作用。
我不能使用像 nav.twig 或 ./nav.twig 这样的相对路径 - twig 会抛出错误。
如何使 twig 使用相对路径,以便在 PhpStorm 中使用源代码?
【问题讨论】:
-
尝试最明显的方法:将您的
template文件夹标记为资源根