Sök

Språk

Kandidater till ALMA-priset 2022
Fel uppstod under bearbetning av mallen.
The following has evaluated to null or missing:
==> articleBody  [in template "6578609#6578643#5935341" at line 81, column 10]

----
Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
----

----
FTL stack trace ("~" means nesting-related):
	- Failed at: #if articleBody.getSiblings()?has_con...  [in template "6578609#6578643#5935341" at line 81, column 5]
----
1<#-- 
2https://gist.github.com/emiloberg/b4382b9a6946a183cddd 
3https://gsmblog.net/date-objects-liferay-freemarker-web-content-templates/ 
4 
5Publication and modification date logic for the different locales 
6<#assign publishDate = .vars['reserved-article-display-date'].data> 
7<#assign modifyDate = .vars['reserved-article-modified-date'].data> 
8--> 
9<#-- This gives us dates in this long format "Thu, 15 Oct 2020 09:16:00 +0200" 
10which requires some work to transform to shorter date formats, see below --> 
11 
12<#-- Saving original locale (sv_SE for example) to be able to reset it to that later 
13<#assign originalLocale = locale> 
14 --> 
15<#-- Set locale to en_US to be able to parse the date string and make it a date object 
16<#setting locale = 'en_US'> 
17<#assign publishDate = publishDate?datetime("EEE, d MMM yyyy HH:mm:ss Z")> 
18<#assign modifyDate = modifyDate?datetime("EEE, d MMM yyyy HH:mm:ss Z")> 
19 --> 
20<#-- Set locale to the real (original) locale 
21<#setting locale = originalLocale> 
22--> 
23<#-- As we want to display the date in different formats depending on the 
24     language we get the date/time-format from the language files. Else 
25     we could set it like this: 
26     <#assign dateTimeFormat = "d MMMM yyyy"> 
27<#assign dateTimeFormat = languageUtil.get(locale, "template-datetime-format")> 
28--> 
29<#-- 
30<#switch originalLocale> 
31    <#case "de_DE"> 
32        <#assign dateTimeFormat = "dd.MM.yyyy"> 
33        <#break> 
34    <#case "en_GB"> 
35        <#assign dateTimeFormat = "dd/MM/yyyy"> 
36        <#break> 
37    <#case "en_US"> 
38        <#assign dateTimeFormat = "M/d/yyyy"> 
39        <#break> 
40    <#case "fi-FI"> 
41        <#assign dateTimeFormat = "d.M.yyyy"> 
42        <#break> 
43    <#case "fr_FR"> 
44        <#assign dateTimeFormat = "dd/MM/yyyy"> 
45        <#break> 
46    <#case "nb_NO"> 
47    <#case "nn_NO"> 
48        <#assign dateTimeFormat = "dd.MM.yyyy"> 
49        <#break> 
50    <#case "ru_FI"> 
51        <#assign dateTimeFormat = "dd.MM.yyyy"> 
52        <#break> 
53    <#case "sv_SE"> 
54    <#default> 
55        <#assign dateTimeFormat = "yyyy-MM-dd"> 
56        <#break> 
57</#switch> 
58--> 
59<#--${dateTimeFormat}--> 
60<#-- Create a date string from the date object 
61<#assign publishDate = publishDate?string(dateTimeFormat)> 
62<#assign modifyDate = modifyDate?string(dateTimeFormat)> 
63--> 
64 
65<#-- --------------------------------------------------------------- --> 
66<#-- Featured Image ---> 
67<#if articleHeader.featuredImage.getData() !=""> 
68    <#assign className = "image" /> 
69    <#assign bgImage = "url(" + articleHeader.featuredImage.getData() + ")" /> 
70<#else> 
71    <#assign className = "no-image" /> 
72    <#assign bgImage = "none" /> 
73</#if> 
74 
75<#-- --------------------------------------------------------------- --> 
76<#-- This is the actual output of the article --> 
77<div class="article-basic-header ${className} break-out" style="background-image: ${bgImage}"></div> 
78<article class="article-basic-container"> 
79    <h1 class="article-basic-title">${.vars['reserved-article-title'].data}</h1> 
80    <div class="article-basic-summary">${.vars['reserved-article-description'].data}</div> 
81    <#if articleBody.getSiblings()?has_content> 
82        <#list articleBody.getSiblings() as cur_articleBody> 
83            <div class="article-basic-body"> 
84                ${cur_articleBody.getData()} 
85 
86                <#-- 
87                <div class="article-publish-date"> 
88                    <p><span><@liferay.language key="published"/>:</span> ${publishDate}</p> 
89                    <#if publishDate != modifyDate> 
90                        <p><span><@liferay.language key="updated"/>:</span> ${modifyDate}</p> 
91                    </#if> 
92                </div> 
93                --> 
94            </div> 
95        </#list> 
96    </#if> 
97</article>