Skip to content

Instantly share code, notes, and snippets.

@SergioLarios
Created November 10, 2016 10:18
Show Gist options
  • Save SergioLarios/e68b69a21fccc00fab0943bf99f8a586 to your computer and use it in GitHub Desktop.
Save SergioLarios/e68b69a21fccc00fab0943bf99f8a586 to your computer and use it in GitHub Desktop.
#set ($LayoutLocalService = $serviceLocator.findService("com.liferay.portal.service.LayoutLocalService"))
#set ($JournalArticleLocalService = $serviceLocator.findService("com.liferay.portlet.journal.service.JournalArticleLocalService"))
#if(!$entries.isEmpty())
<div class="comentariosCuyuntura">
<div class="container">
<ul class="blockComentarios">
#set($count = 0)
#set($sortedList = [])
$sortedList.ensureCapacity($entries.size())
#foreach ($entry in $entries)
#set( $renderer = $entry.getAssetRenderer() )
#set( $journalArticle = $renderer.getArticle() )
#set( $doc = $saxReaderUtil.read($journalArticle.getContentByLocale($themeDisplay.languageId)) )
#set( $root = $doc.getRootElement() )
#set( $foo = $sortedList.add({
'weight' : $getterUtil.getLong("#getField2($root 'Fecha_CCE')", 0),
'data' : $journalArticle}))
#end
#set( $sortedList = $sortTool.sort($sortedList, 'weight:desc'))
#foreach($entryArticle in $sortedList)
<li class="comentariosSingle">
#getJaDisp4($entryArticle.data $tmplId1)
</li>
#end
</ul>
</div>
</div>
#end
#macro (getJaDisp4 $ja $tmpl)
$journalContentUtil.getDisplay(
$ja.groupId,
$ja.articleId,
$tmpl, "VIEW", '$locale', $themeDisplay
).content
#end
#macro (getField2 $root $fName)#*
*##set ($xPathSelector = $saxReaderUtil.createXPath("dynamic-element[@name='$fName']"))#*
*#$!xPathSelector.selectSingleNode($root).getStringValue()#*
*##end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment