留言板

How to get webcontent url ?

Amit Sinha,修改在7 年前。

How to get webcontent url ?

Junior Member 帖子: 43 加入日期: 14-12-31 最近的帖子
Hello everyone,
Is there anyway to get url of a particular webcontent in liferay 6.2
my need is to share webcontent in facebook and whatsapp.
For that, in one of the parameter for sharing, webcontent's url is to be passed.

i have referred few sites to get url programatically, which stated to use
themeDisplay.getPortalURL() + themeDisplay.getPathMain() with groupId, folderId and articleId
i got url like
http://localhost:8080/c/journal/view_article_content?groupId=20181&folderId=30901&articleId=35193&version=1.2
but this url displays blank page

In other method i added Content Display Page portlet in Display page and then put the required particular web content in that Content Display portlet. But this also does not solve my problem, as in this, url generated is, url of whole display page.

As per my need url, i only need web content url. How to do this.

Thanks and Regards,
Amit.
thumbnail
Fernando Fernandez,修改在7 年前。

RE: How to get webcontent url ?

Expert 帖子: 396 加入日期: 07-8-22 最近的帖子
Hi Amit,

Here's a piece of code I use in an AssetPublisher ADT to display the WebContent URL:
#foreach ($entry in $entries)
    #set($renderer = $entry.getAssetRenderer() ) 
    #set( $ProjectUrlTitle = $renderer.getUrlTitle() )
    <a href="/-/$ProjectUrlTitle">
...
#end</a>


HTH

Fernando