Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to embed WebContent in freemarker Liferay 7 theme?

Tags:

liferay

I have found how to embed WebContent in Liferay 6.2 theme using journalContentUtil.getContent method. My question is how to do the same thing in Liferay 7?

like image 298
Stefania Izzo Avatar asked Jul 06 '16 15:07

Stefania Izzo


1 Answers

I have found the way fix web content via custom ftl template in Liferay 7/DXP.

Below is the sample code,

<#assign VOID = freeMarkerPortletPreferences.setValue("portletSetupPortletDecoratorId", "barebone") />
<#assign theme_groupID = htmlUtil.escape(theme_display.getCompanyGroupId()?string) />
<#assign VOID = freeMarkerPortletPreferences.setValue("groupId", '${group_id}') />
<#assign VOID = freeMarkerPortletPreferences.setValue("articleId", "yourarticleid") />



        <@liferay_portlet["runtime"]
        defaultPreferences="${freeMarkerPortletPreferences}"
        portletProviderAction=portletProviderAction.VIEW
        instanceId="footercontent"
        portletName="com_liferay_journal_content_web_portlet_JournalContentPortlet" />
        ${freeMarkerPortletPreferences.reset()}

Make sure the articleId which you are providing in preferences is under the groupId.Means group/site should contains the webcontent.

like image 164
Abhishek Suthar Avatar answered Oct 14 '22 23:10

Abhishek Suthar