我在所有文件(js,css,php,...)中添加了许可文本,但是在尝试在.html.twig
文件中添加文本时遇到了问题。我尝试过以下代码:
<!--
Itransformer.es is an online application to transform images
Copyright (C) 2013 Manolo Salsas
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Contact: manolez@gmail.com - http://msalsas.com
-->
{% extends 'MSDHomeBundle::base.html.twig' %}
{% block javascripts %}
...
我收到了这个错误:
A template that extends another one cannot have a body in MSDHomeBundle:Home:index.html.twig at line 2.
我也尝试在{% extends 'MSDHomeBundle::base.html.twig' %}
之后添加它,但我收到同样的错误。
如何解决它?
答案 0 :(得分:6)
树枝中的评论如下:{# <comment> #}
您可以将许可证/作者信息添加到twig文件,如下所示:
{#
@author Firstname Lastname
@copyright 2013
LICENSE:
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
...
#}
{% extends 'MSDHomeBundle::base.html.twig' %}
答案 1 :(得分:4)
从另一个模板扩展时,必须对已定义块内的所有内容进行编码。 因此,您应该为许可证定义一个块,并像使用'javascripts'
那样实现它{% block license %}
<!-- license text goes here -->
{% endblock %}