Drupal 8包含零件模板 [英] Drupal 8 include part template
问题描述
但是,我正常地调用这个模板,我只收到一个带有模板名称的字符串。
例如:
{#in page.html.twig或page - front .html.twig#}
{%include'parts / footer.html.twig'%}
将文件名作为字符串返回:
parts / footer.html.twig
可以使用Drupal 8执行此操作吗?
可以使用路径中的模板名称
{%include'@ mytheme / parts / footer。 html.twig'%}
感谢 https://drupal.stackexchange.com/questions/141066/drupal-8-include-part-template
I'm trying to use Drupal 8, with an own theme, due big structure differences for my requirements I have a page--front.twig.html and a page.twig.html, I would like to create template parts as used in phrozn oder in a normal Symfony2 project, for example a footer.html.twig and a header.html.twig. These templates are saved under a subdirectory /parts/
But wenn I call this templates as normal I just receive a string with the name of the template.
For example:
{# in page.html.twig or page--front.html.twig #}
{% include 'parts/footer.html.twig' %}
Returns the file name as string:
parts/footer.html.twig
It's possible to do that with Drupal 8?
it's possible using the name of the template in the path
{% include '@mytheme/parts/footer.html.twig' %}
thanks to https://drupal.stackexchange.com/questions/141066/drupal-8-include-part-template
这篇关于Drupal 8包含零件模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!