Fórumok

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

Bhavik Shah, módosítva 8 év-val korábban

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

Junior Member Bejegyzések: 64 Csatlakozás dátuma: 2015.05.21. Legújabb bejegyzések
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, módosítva 8 év-val korábban

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

Liferay Master Bejegyzések: 621 Csatlakozás dátuma: 2008.07.07. Legújabb bejegyzések
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, módosítva 8 év-val korábban

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

Junior Member Bejegyzések: 64 Csatlakozás dátuma: 2015.05.21. Legújabb bejegyzések
Hi Alexey Kakunin,

Yes it is working fine. Thanks for your help.

Regards,
Bhavik
Bhavik Shah, módosítva 8 év-val korábban

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

Junior Member Bejegyzések: 64 Csatlakozás dátuma: 2015.05.21. Legújabb bejegyzések
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, módosítva 8 év-val korábban

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

Junior Member Bejegyzések: 64 Csatlakozás dátuma: 2015.05.21. Legújabb bejegyzések
Hello Team,

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

Regards,
Bhavik Shah
Knowarth Technologies