Si è verificato un errore nell'elaborarazione del modello.
The following has evaluated to null or missing: ==> lmainImage [in template "135401#135436#182882" at line 42, column 52] ---- 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: ${lmainImage} [in template "135401#135436#182882" at line 42, column 50] ----
1<#assign
2 journalServiceAPI = serviceLocator.findService("com.liferay.journal.service.JournalArticleLocalService")
3 suggestoGUIAPI = serviceLocator.findService("eu.suggesto.suggestogui.service.SuggestoGuiLocalService")
4 LLS = serviceLocator.findService("com.liferay.portal.kernel.service.LayoutLocalService")
5
6 plid = themeDisplay.plid?number
7 curLayout = LLS.getLayout(plid)
8 layoutId = curLayout.layoutId?number
9 lsLayouts = LLS.getLayouts(groupId, false, layoutId, false, 0, 99999)
10 err = "ok"
11/>
12
13<#if lsLayouts?has_content>
14 <section id="strip_event" class="square_block spacer-v">
15 <div class="container-fluid scheme">
16 <div class="row">
17 <#list lsLayouts as aLayout>
18 <#if suggestoGUIAPI.getJournalArticleByMainLayoutPlid(groupId?string, aLayout.getPlid())??>
19 <#assign
20 journalArticle = suggestoGUIAPI.getJournalArticleByMainLayoutPlid(groupId?string, aLayout.getPlid())
21 ldocument = saxReaderUtil.read(journalArticle.getContent())
22 lrootElement = ldocument.getRootElement()
23 lmainImage = getLiferayDocSingleField(lrootElement, "immagine")
24 />
25 <#if lmainImage?has_content>
26 <#assign lpreviewImage = getUrlLiferayImage(lmainImage)>
27 <#else>
28 <#assign err = "getting field">
29 <#assign lpreviewImage = "/documents/135935/159035/img_02.jpg">
30 </#if>
31 <#else>
32 <#assign err = "getting article">
33 <#assign lpreviewImage = "/documents/135935/159035/img_02.jpg"> <#-- Fallback image -->
34 </#if>
35
36 <#assign
37 pageTitle = aLayout.getName(themeDisplay.getLocale())
38 pageUrl = aLayout.getFriendlyURL()
39 />
40
41 <div class="col-md-4 block">
42 <p class="d-none">${err} ${lmainImage}</p>
43 <a href="${pageUrl}">
44 <div class="content" style="background-image: url(${lpreviewImage})">
45 <div class="title">
46 <i class="fa fa-arrow-right"></i>
47 <h2>${pageTitle}</h2>
48 </div>
49 </div>
50 </a>
51 </div>
52 </#list>
53 </div>
54 </div>
55 </section>
56</#if>
57
58<#function getLiferayDocSingleField rootEl fieldName>
59 <#-- "dynamic-element[@name='" + fieldName + "']/dynamic-content[@language-id = 'it_IT']" -->
60
61 <#assign
62 stringSelector = "dynamic-element[@name='" + fieldName + "']"
63 xPathSelector = saxReaderUtil.createXPath(stringSelector)
64 ret = ""
65 />
66 <#if xPathSelector.selectSingleNode(rootEl)??>
67 <#assign ret = xPathSelector.selectSingleNode(rootEl).getStringValue()>
68 </#if>
69
70 <#return ret>
71</#function>
72
73<#function getUrlLiferayImage imgDoc>
74 <#if imgDoc?has_content>
75 <#assign imgDocN = imgDoc?replace("\\","")?eval>
76 <#return "/documents/" + imgDocN.groupId + "/0000/bin/" + imgDocN.uuid>
77 <#else>
78 <#return defaultImage>
79 </#if>
80</#function>