【发布时间】:2017-07-22 20:01:36
【问题描述】:
我在 WordPress CMS 上使用 Gantry5 模板。
在我的粒子树枝文件exampleparticle.html.twig中:
{% if particle.style == 'style2' %}
Some title here
{% include 'style2.html.twig' %}
在页面上我看到文本“Some title here”并在此文本错误下:
Error while rendering exampleparticle particle.
如果使用这个字符串:
{% include 'style2.html.twig' ignore missing %}
然后我只看到文本:“Some title here”。原来系统找不到文件style2.html.twig。这两个文件位于一个目录中。
附:对不起我的英语。
【问题讨论】:
-
style2里面有什么,您尝试包含一个空文件 -
包含的文件不为空
-
不,我的意思是尝试使用一个空的包含:-) 你可能有一个错误
style2模板。问号从我的问题中消失了 -
包含的文件它还必须有一个树枝标记?
-
不需要。用第二个模板中的内容更新问题?
标签: wordpress templates include twig