留言板

How to fetch blog and forum(Message Board) entries in Asset Publisher Portl

Bhavik Shah,修改在8 年前。

How to fetch blog and forum(Message Board) entries in Asset Publisher Portl

Junior Member 帖子: 64 加入日期: 15-5-21 最近的帖子
Hello Team,

I am able to fetch list of web content in Asset Publisher Portlet through ADT using below code.

#set ($articleContent = $journalContentUtil.getContent($themeDisplay.getScopeGroupId(), $articleId.toString(), null, $locale.toString(), $themeDisplay))

But I am not able to find how to fetch blog and forum(Message Board) entries in Asset Publisher Portlet through ADT.

Also is there any way to get Blog from blogId same as get JournalArticle from articleId?

Can you please help asap?

Thanks & Regards,
Bhavik Shah
KNOWARTH Technologies
thumbnail
Alexey Kakunin,修改在8 年前。

RE: How to fetch blog and forum(Message Board) entries in Asset Publisher P (答复)

Liferay Master 帖子: 621 加入日期: 08-7-7 最近的帖子
Hi!

To get BlogsEntry you need to use BlogsEntryLocalService service and it's method getBlogsEntry.
Same for MessageBoard - MBMessageLocalService and it's method getMBMessage

Here is sample (in freemaker - but for velocity names of variables will be same) demonstated how to list assets in publisher, get blog from them and get it's content


<#assign blogsEntryLocalService = serviceLocator.findService("com.liferay.portlet.blogs.service.BlogsEntryLocalService")/>

<#if entries?has_content>
	<#list entries as curEntry>
	    <#assign blog = blogsEntryLocalService.getBlogsEntry(curEntry.getClassPK()) />
		${blog.getTitle()}
		<hr>
		${blog.getContent()}
	<!--#list-->
<!--#if-->


Please note - here we using special variable "servoceLocator" to get service. By default this variable is "restricted" from usage in templates, so, to enable it in both - Velocity and Freemaker you need to add followed properties into portal-ext.properties and restart portal:


freemarker.engine.restricted.variables=
velocity.engine.restricted.variables=


Hope this will help!

====
Alexey Kakunin
Liferay Experts in Russia
Bhavik Shah,修改在8 年前。

RE: How to fetch blog and forum(Message Board) entries in Asset Publisher P

Junior Member 帖子: 64 加入日期: 15-5-21 最近的帖子
Hi Alexey Kakunin,

Yes it is working fine. Thanks for your help.

Regards,
Bhavik
Bhavik Shah,修改在8 年前。

RE: How to fetch blog and forum(Message Board) entries in Asset Publisher P

Junior Member 帖子: 64 加入日期: 15-5-21 最近的帖子
hi Team,

I am getting article from articleId through below code and it is working fine for that site only.

#set ($articleContent = $journalContentUtil.getContent($themeDisplay.getScopeGroupId(), $articleId, null, $locale.toString(), $themeDisplay))

For child site, it is not working.
I am getting child site's web content from Parent Site's asset publisher through ADT.

Let me know the way to get child site web content by article id in parent site asset publisher.

Regards,
Bhavik Shah
Bhavik Shah,修改在8 年前。

RE: How to fetch blog and forum(Message Board) entries in Asset Publisher P (答复)

Junior Member 帖子: 64 加入日期: 15-5-21 最近的帖子
Hello Team,

I solved this issue by passing child site group id in getContent() method.

Regards,
Bhavik Shah
Knowarth Technologies