Briciole di pane

Aggregatore Risorse

Si è verificato un errore nell'elaborarazione del modello.
Range end index 360 is out of bounds, because the sliced string has only 357 character(s). (Note that indices are 0-based).
The blamed expression:
==> 0..max  [in template "493537#493583#571741" at line 92, column 45]

----
FTL stack trace ("~" means nesting-related):
	- Failed at: ${testo[0..max]}  [in template "493537#493583#571741" at line 92, column 37]
----
1<#-- ADT Tutte le News --> 
2<#setting locale = locale> 
3<#assign currentURL = portalUtil.getCurrentURL(request) /> 
4 
5<#assign dlFileEntryService = serviceLocator.findService('com.liferay.document.library.kernel.service.DLFileEntryLocalService') />  
6<#assign dlUtil = serviceLocator.findService('com.liferay.document.library.kernel.util.DLUtil') />  
7<#assign dlAppService = serviceLocator.findService('com.liferay.document.library.kernel.service.DLAppService') />  
8 
9<#if entries?has_content> 
10	<section> 
11        <div class="row"> 
12             
13            <#list entries as entry> 
14                <#assign assetRenderer = entry.assetRenderer /> 
15                <#assign journalArticle = assetRenderer.getArticle() /> 
16                <#assign document = saxReaderUtil.read(journalArticle.getContent()) /> 
17                <#assign rootElement = document.getRootElement() /> 
18 
19                <#assign titolo = entry.getTitle(locale) /> 
20                <#assign imgPath = themeDisplay.getPathThemeImages() /> 
21                <#--assign img = (rootElement.selectSingleNode( "//dynamic-element[@name='Immagine']").getStringValue()) /--> 
22                
23                <#list rootElement.elements() as dynamicElement> 
24                    <#if dynamicElement.attributeValue("name") == "Immagine"> 
25                        <#assign immagine = dynamicElement.element('dynamic-content').getText()> 
26                    
27                        <#assign image = "" /> 
28                         
29 
30 
31                         
32                        <#if immagine?has_content> 
33                            <#attempt>  
34                                <#assign imageJson = immagine?eval />  
35                                <#assign dlFileEntry = dlFileEntryService.getFileEntryByUuidAndGroupId(imageJson.uuid, imageJson.groupId?number) />  
36                                <#assign fileEntry = dlAppService.getFileEntry(dlFileEntry.fileEntryId) />  
37                                <#assign dlFile = dlUtil.getPreviewURL(fileEntry, fileEntry.getFileVersion(), themeDisplay, "") />  
38                                <#assign image = dlFile /> 
39                                <#recover></#attempt> 
40                        </#if> 
41                        <#if (image?length<10) > 
42                            <#assign img = imgPath+"/nrg-img-default.jpg" /> 
43                        </#if> 
44 
45                    </#if> 
46                </#list> 
47 
48 
49                <#assign sottotitolo = (rootElement.selectSingleNode( "//dynamic-element[@name='sottotitolo']")) /> 
50                <#assign paragrafo = (sottotitolo.selectNodes( "//dynamic-element[@name='paragrafo']")) /> 
51                <#assign testo = paragrafo[0].getStringValue() /> 
52                <#assign assetRenderer = entry.assetRenderer /> 
53                <#assign url = assetRenderer.getURLViewInContext(renderRequest, renderResponse, '') ! ""/>     
54                <#assign data = (rootElement.selectSingleNode( "//dynamic-element[@name='Data']").getStringValue()?replace('\\n+','','r')) />                 
55                 
56                <#-- indirizzo generico per i web content se non è impostata una pagina specifica --> 
57                <#if url == "">  
58                    <#assign genericUrl = assetPublisherHelper.getAssetViewURL(renderRequest, renderResponse, entry) /> 
59                    <#if assetLinkBehavior != "showFullContent">  
60                        <#assign genericUrl = renderer.getURLViewInContext(renderRequest, renderResponse, genericUrl) />  
61                    </#if>  
62                    <#assign url = genericUrl /> 
63                </#if>  
64 
65                
66 
67 
68                <#assign cat = entry.getCategories() > 
69                 
70                <div class="col-sm-6 col-md-4 news"> 
71                    <a href="${url}"> 
72	                    <div class="box"> 
73                            <div class="img" style="background-image: url(${image})"></div> 
74                            <#if data?has_content> 
75	                            <#assign dataNew='${data?date("yyyy-MM-dd")}'> 
76	                            <#assign giorno='${dataNew[0..dataNew?index_of("-")-1]}'> 
77	                            <#assign mese='${dataNew[dataNew?index_of("-")+1..*3]}'> 
78	                            <div class="data"><strong>${giorno}</strong><br>${mese}</div> 
79	                        </#if> 
80	                        <div class="testo"> 
81	                            <#list cat as cat> 
82		                			<#if cat.name != "In evidenza - HP"> 
83		                				<span>${cat.name}</span> 
84		                			</#if> 
85		                		</#list> 
86 
87                                <h2>${titolo}</h2> 
88 
89                                <#assign max=(435-(titolo?length*2.35))?round> 
90                                <#if (testo?length > max) > 
91                                    <#assign testo = testo?replace('<[^>]+>','','r')> 
92                                    ${testo[0..max]} [...] 
93                                <#else> 
94                                    ${testo?replace('<[^>]+>','','r')} 
95                                </#if> 
96                            </div> 
97	                    </div> 
98	                </a> 
99                </div> 
100             
101			</#list> 
102 
103        </div> 
104    </section> 
105</#if> 

Aggregatore Risorse