Actualités - Groupe P&V (groupepv.coop)
Actualités
News categories
Une erreur s'est produite en traitant le modèle.
Can't convert this string to number: "www.pv.be" The blamed expression: ==> currentUrl?substring(currentUrl?last_index_of("/") + 1, currentUrl?length)?number [in template "20097#20123#48170" at line 55, column 47] ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign categoryId = currentUrl?subst... [in template "20097#20123#48170" at line 55, column 25] ----
1<#assign currentUrl = themeDisplay.getURLCurrent() />
2
3<#assign linkUrlStart = "" />
4<#if currentUrl?contains("/web/") >
5 <#assign linkUrlStart = "/web" + themeDisplay.getSiteGroup().friendlyURL />
6 <#elseif currentUrl?contains("/group/") >
7 <#assign linkUrlStart = "/group" + themeDisplay.getSiteGroup().friendlyURL />
8 </#if>
9
10 <#assign assetCategoryLocalService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetCategoryLocalService") />
11 <#function getArticleCategories articleResourcePK >
12 <#assign thisArticleCategoriesList = assetCategoryLocalService.getCategories("com.liferay.journal.model.JournalArticle", articleResourcePK) />
13 <#assign allCategoriesHtml = "" />
14 <#list thisArticleCategoriesList as categoryListItem>
15 <#assign allCategoriesHtml = allCategoriesHtml + "<span>${categoryListItem.getTitle(locale)}</span>" />
16 </#list>
17
18 <#return allCategoriesHtml />
19 </#function>
20
21 <#function getSmallArticleImg articleEntry articleType >
22 <#assign noImageFoundUrl = "/documents/d/global/no-image-available" />
23 <#if articleType?contains("JournalArticle")>
24 <#assign theRenderer = articleEntry.getAssetRenderer() />
25 <#assign theArticle = theRenderer.getArticle() />
26
27 <#if theArticle.smallImageId != 0 >
28 <#return "/image/journal/article?img_id=" + theArticle.smallImageId />
29 <#else>
30 <#return noImageFoundUrl />
31 </#if>
32 <#else>
33 <#return noImageFoundUrl />
34 </#if>
35 </#function>
36
37 <#function getArticleReadMoreUrl articleEntry articleType >
38 <#assign theArticleReadMoreUrl = "" />
39 <#if articleType?contains("JournalArticle")>
40 <#-- <#assign theRenderer = articleEntry.getAssetRenderer() /> -->
41 <#-- <#assign theArticle = theRenderer.getDDMFormValuesReader().getDDMFormValues().getDDMFormFieldValues() /> -->
42 <#-- .getArticle().getDDMStructure().getDDMFormField("theArticleExternalLink") -->
43 <#-- <#assign theArticle = theRenderer.getArticle().getExpandoBridge().getAttributeNames() /> -->
44
45 <#assign theArticleReadMoreUrl = linkUrlStart + "/-/" + assetPublisherHelper.getAssetViewURL(renderRequest, renderResponse, articleEntry)?keep_before_last("?")?keep_after_last("/") />
46 <#else>
47 <#assign theArticleReadMoreUrl = "#" />
48 </#if>
49
50 <#return theArticleReadMoreUrl />
51 </#function>
52
53
54 <#if currentUrl?contains("/-/categories/") >
55 <#assign categoryId = currentUrl?substring(currentUrl?last_index_of("/") + 1, currentUrl?length)?number />
56 <div class="">
57 <h2 class="">
58 <@liferay_ui["message"] key="articlesOfCategory" />: ${assetCategoryLocalService.getCategory(categoryId).getTitle(locale)}
59 </h2>
60 <a href="${linkUrlStart}/actua" class=""><@liferay_ui["message"] key="showAllArticles" /></a>
61 </div>
62 </#if>
63
64
65
66 <div class="row row-cols-1 row-cols-sm-2 row-cols-lg-3">
67 <#if entries?has_content>
68 <#list entries as curEntry>
69
70
71 <div class="col mb-4">
72 <div class="card card-interactive h-100 rm-article-overview">
73 <div class="outer-image-container card-img-top">
74 <div class="inner-image-container">
75 <img src="${getSmallArticleImg(curEntry, curEntry.getClassName())}" alt="...">
76 </div>
77 </div>
78 <div class="card-body">
79 <h5 class="card-title">
80 ${curEntry.getTitle(locale)}
81 </h5>
82 <p class="card-text">
83 <#if curEntry.getSummary(locale)?length gt 200 >
84 <#assign theSummary = curEntry.getSummary(locale)[0..200]?replace('<[^>]+>','','r') + "..." />
85 <#else>
86 <#assign theSummary = curEntry.getSummary(locale)?replace('<[^>]+>','','r') />
87 </#if>
88 ${theSummary}
89 </p>
90 <p class="card-text icon date small">
91 ${dateUtil.getDate(curEntry.getPublishDate(), "d MMMM yyyy", locale)}</p>
92 <p class="card-text text-muted small rm-article-overview-categories"><@liferay_ui["message"] key="articlePostedInCategory" />: ${getArticleCategories(curEntry.getClassPK())}
93 </p>
94 </div>
95 <div class="card-footer">
96 <a href="${getArticleReadMoreUrl(curEntry, curEntry.getClassName())}" class="stretched-link"><@liferay_ui["message"] key="read-more"/><span class="icon readmore"></span></a>
97
98 </div>
99 </div>
100 </div>
101
102 </#list>
103 </#if>
104 </div>