14 August, 2012

Terms of use page in Liferay 6.1

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:
Article Id

Here Group Id is 10180:
GroupId
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

Rate Me:

2 comments:

  1. You mention that your article ID is 18981 but by looking at your screenshot, was the article ID suppose to be 13918?

    ReplyDelete
  2. What is the correct article ID here?
    Is it 18981 like you mention or 13918 like displayed on your screenshot?

    ReplyDelete

Your Comments on this post

Create Servlet Project as Module

You would have seen that many times we are writing out own servlet in Liferay portal to achieve some specific use case. In DXP, You can st...