Skip to content

Instantly share code, notes, and snippets.

@einsty
Last active February 27, 2017 15:47
Show Gist options
  • Save einsty/445336092cd361939d496e6c71a8044b to your computer and use it in GitHub Desktop.
Save einsty/445336092cd361939d496e6c71a8044b to your computer and use it in GitHub Desktop.
Simple Liferay, Velocity, ADT code to render Journal Article HTML using the articles' default Display Template.
#set ($journalArticleService = $serviceLocator.findService("com.liferay.portlet.journal.service.JournalArticleLocalService"))
#if (!$entries.isEmpty())
#foreach ($curEntry in $entries)
#set($renderer = $curEntry.getAssetRenderer() )
#set($className = $renderer.getClassName() )
#if( $className == "com.liferay.portlet.journal.model.JournalArticle" )
#set ($article = $journalArticleService.getLatestArticle($curEntry.getClassPK()))
#set ($articleId = $article.getArticleId())
#set ($ddmTemplateKey = $article.getTemplateId())
#set ($viewMode = $renderRequest.getPortletMode())
#set ($languageId = $themeDisplay.getLanguageId())
#set ($articleGroupId = $article.getGroupId())
#set ($entryMarkup = $journalContentUtil.getContent($articleGroupId, "$articleId", "$ddmTemplateKey", "$viewMode", "$languageId", $themeDisplay))
$entryMarkup
#end
#end
#end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment