Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 为drupal 8中的区域创建一个模板文件_Php_Templates_Drupal_Twig_Drupal 8 - Fatal编程技术网

Php 为drupal 8中的区域创建一个模板文件

Php 为drupal 8中的区域创建一个模板文件,php,templates,drupal,twig,drupal-8,Php,Templates,Drupal,Twig,Drupal 8,例如,我希望在单个细枝文件中包含页脚 以下是我的区域: regions: nav: Navigation content: Content content_top: 'Content Top' content_bottom: 'Content Bottom' front_one: 'Front One' front_two: 'Front Two' footer: Footer 我尝试在主题的templates文件夹中创建region-footer.html.twi

例如,我希望在单个细枝文件中包含页脚

以下是我的区域:

regions:
  nav: Navigation
  content: Content
  content_top: 'Content Top'
  content_bottom: 'Content Bottom'
  front_one: 'Front One'
  front_two: 'Front Two'
  footer: Footer
我尝试在主题的templates文件夹中创建region-footer.html.twig文件,但没有成功


有什么建议吗?

在drupal 8中指点新模板之后,我成功地完成了:

在my page.html.twig的最底部:

{% if page.footer %}
  {{ page.footer }}
{% endif %}
然后创建了一个region-footer.html.twig,其中包含以下内容:

{% if content %}
      <div{{ attributes }}>
        {{ content }}
      </div>
{% endif %}
我从core/modules/system/templates/region.html.twig中得到了这个片段


我认为这是覆盖Drupal 8中模板的正确方法。请更详细地告诉我们您尝试了什么以及出现了什么/如何出错。Drupal使用的所有模板都被经典主题覆盖。建议您将其用作基本主题。