2016-10-15 48 views
0

我正要通过listings.twig文件和跨越以下几行代码就来了:螺栓中的“record.introduction”和“record.teaser”是什么?

<h2><a href="{{ record.link }}">{{ record.title }}</a></h2> 
{% if record.introduction %} 
    {{ record.introduction }} 
{% elseif record.teaser %} 
    {{ record.teaser }} 
{% else %} 
    <p>{{ record.excerpt(300, false, search|default('')) }}</p> 
{% endif %} 

现在究竟是什么record.introductionrecord.teaser?我了解最后的else部分,但我不太了解ifelseif部分。有人可以解释什么record.introductionrecord.teaser真的是什么?

回答

1

这是ContentType中的两个字段。它们在app/config/contenttypes.yml中定义。

您的粘贴代码会检查引言字段是否可用或是否有内容,如果不是,则会尝试引导字段。