[英]Twig Templates not extending
I have just setup a apache server and configured twig. 我刚刚设置了一个Apache服务器并配置了树枝。 I have two template files one called
base.html.twig
which has the core template elements and dashboard with blocks that correspond to the base.html.twig
我有两个模板文件,一个叫做
base.html.twig
,它具有核心模板元素和带有与base.html.twig
对应的块的仪表板
dashboard.html.twig dashboard.html.twig
{% extends "base.html.twig" %}
{% block content %}
<h1>Index</h1>
<p class="important">
Welcome on my awesome homepage.
</p>
{% endblock %}
However when I browse to dashboard.html.twig
I just see plain html showing all of the code above. 但是,当我浏览至
dashboard.html.twig
我只看到显示上面所有代码的纯html。 Have I misconfigured something? 我配置错误了吗?
I am sure it's something simple so I thank you for your help in advance. 我相信这很简单,因此我感谢您的帮助。
You should not directly "browse" to a twig file, it needs to be parsed and rendered by php objects using classes from Twig libraries. 您不应该直接“浏览”到一个twig文件,它需要使用Twig库中的类由php对象进行解析和呈现。
see http://twig.sensiolabs.org/documentation 参见http://twig.sensiolabs.org/documentation
To use twig you need PHP installed too. 要使用树枝,您也需要安装PHP。 Also you would need Twig PHP library to parse twig templates.
另外,您将需要Twig PHP库来解析Twig模板。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.