Last active
June 29, 2022 11:01
-
-
Save gonzalezalo/548184d945546d72227bf9d64702a82e to your computer and use it in GitHub Desktop.
Using Liferay WebContent Template from ADT - Liferay 7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<#-- Liferay info on templates: https://dev.liferay.com/discover/portal/-/knowledge_base/7-0/designing-uniform-content --> | |
<#-- There is more than just a way of doing this: --> | |
<#-- Option 1 --> | |
<#assign journalArticleLocalService = serviceLocator.findService("com.liferay.journal.service.JournalArticleLocalService")> | |
<#if entries?has_content> | |
<#list entries as curEntry> | |
<#assign article = curEntry.getAssetRenderer().getArticle() /> | |
<#assign model = objectUtil("com.liferay.portal.kernel.portlet.PortletRequestModel", renderRequest, renderResponse) /> | |
${journalArticleLocalService.getArticleContent(article, article.getDDMTemplateKey(), "VIEW", locale, model, themeDisplay)} | |
</#list> | |
</#if> | |
<#-- Option 2 --> | |
<#-- Thanks to Kevin Boucher - https://stackoverflow.com/questions/45242941/how-can-i-access-a-web-content-structure-template-from-an-application-display-te/45248102#45248102 --> | |
<#if entries?has_content> | |
<#list entries as curEntry> | |
<#assign assetRenderer = curEntry.getAssetRenderer() /> | |
<@liferay_ui["asset-display"] | |
assetEntry=curEntry | |
assetRenderer=assetRenderer | |
showExtraInfo=false /> | |
</#list> | |
</#if> |
Mr Hiker ... LIFESAVER !! Thank You.
In 7.0 I had : <@liferay_ui["asset-display"]
in 7.3 it didn't work. The documentation around this wasn't clear enough there from Liferay.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
in liferay 7.3 it works this way:
liferay-ui:asset-display → liferay-asset:asset-display
Source:[(https://help.liferay.com/hc/en-us/articles/360017902892-Breaking-Changes)]