2016-10-15 171 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中定義。

您的粘貼代碼會檢查引言字段是否可用或是否有內容,如果不是,則會嘗試引導字段。