Hi Everyone,
If you want to use web content as a terms of use page we have 2 scenario.
First Scenario :
You can simply set below propeties in portal-ext.properties file :
terms.of.use.journal.article.group.id=
terms.of.use.journal.article.id=
you can get article id and group id from control panel as shown in below screenshots:
Here Article Id is 13918:
Here Group Id is 10180:
Second Scenario :
With this scenario you can get article id from article title and group id dynamically.
So you don't need to manually do any settings.
Just follow below steps:
1) Create web content with title "terms-of-use"
2) Replace below section of code in your terms_of_use.jsp page with
<%@page import="com.liferay.portlet.journal.service.JournalArticleLocalServiceUtil"%>
<c:when test="<%= (themeDisplay.getScopeGroupId() > 0) && Validator.isNotNull(String.valueOf(JournalArticleLocalServiceUtil.getArticleByUrlTitle(themeDisplay.getScopeGroupId(),"terms-of-use").getArticleId())) %>">
<liferay-ui:journal-article groupId="<%= String.valueOf(themeDisplay.getScopeGroupId()) %>" articleId="<%= String.valueOf(JournalArticleLocalServiceUtil.getArticleByUrlTitle(themeDisplay.getScopeGroupId(),"terms-of-use").getArticleId()) %>" />
</c:when>
Now check the functionality
If you want to use web content as a terms of use page we have 2 scenario.
First Scenario :
You can simply set below propeties in portal-ext.properties file :
terms.of.use.journal.article.group.id=
terms.of.use.journal.article.id=
you can get article id and group id from control panel as shown in below screenshots:
Here Article Id is 13918:
Here Group Id is 10180:
Second Scenario :
With this scenario you can get article id from article title and group id dynamically.
So you don't need to manually do any settings.
Just follow below steps:
1) Create web content with title "terms-of-use"
2) Replace below section of code in your terms_of_use.jsp page with
<%@page import="com.liferay.portlet.journal.service.JournalArticleLocalServiceUtil"%>
<c:when test="<%= (themeDisplay.getScopeGroupId() > 0) && Validator.isNotNull(String.valueOf(JournalArticleLocalServiceUtil.getArticleByUrlTitle(themeDisplay.getScopeGroupId(),"terms-of-use").getArticleId())) %>">
<liferay-ui:journal-article groupId="<%= String.valueOf(themeDisplay.getScopeGroupId()) %>" articleId="<%= String.valueOf(JournalArticleLocalServiceUtil.getArticleByUrlTitle(themeDisplay.getScopeGroupId(),"terms-of-use").getArticleId()) %>" />
</c:when>
Now check the functionality