留言板

How to find web content displaying given article

thumbnail
Alain Dresse,修改在11 年前。

How to find web content displaying given article

Junior Member 帖子: 95 加入日期: 11-7-18 最近的帖子
Hi,

I would like to have a pointer to a page in which a given journal article (I have the articleId) is displayed in a web context portlet. Something like
Layout getWebContentPage(long groupId, long journalArticleId);

I know that my journalarticle could in theory be published in multiple web contents, so maybe the function above should return a collection...

Thanks and best regards,
Alain
thumbnail
Priyanka Dhingra,修改在11 年前。

RE: How to find web content displaying given article

Liferay Master 帖子: 501 加入日期: 11-12-20 最近的帖子
Hi,
this you can try doing with Asset Publisher or by creating a custom portlet..
JournalArticleLocalServiceUtil.getArticle(assetRenderer.getGroupId(),resource.getArticleId());


This function you can use
thumbnail
Alain Dresse,修改在11 年前。

RE: How to find web content displaying given article

Junior Member 帖子: 95 加入日期: 11-7-18 最近的帖子
Thanks for your quick reply. That helps, as it allows me to display the content of the journalArticle.

I would nevertheless like to get to the page of the webcontent displaying the article.

In other words, I would like to get the list of web-content portlets in a given group that display the journal article based on the Id.

Best,
Alain
thumbnail
Priyanka Dhingra,修改在11 年前。

RE: How to find web content displaying given article

Liferay Master 帖子: 501 加入日期: 11-12-20 最近的帖子
Hi,
static List<JournalArticle> getJournalArticles(int start, int end) --> Gets a range of all the journal articles.

refer to:-
http://docs.liferay.com/portal/6.0/javadocs/com/liferay/portlet/journal/service/JournalArticleLocalServiceUtil.html
thumbnail
Alain Dresse,修改在11 年前。

RE: How to find web content displaying given article

Junior Member 帖子: 95 加入日期: 11-7-18 最近的帖子
Hi,

I have gone through the list, and see how to find the content of the article, and even how to display the article with a template of my choice. What I'm actually after is to find the page (Layout in liferay terms) in which that article is currently displayed in a journal_content, if any.

I don't quite see how to do this, and am not sure it is possible. Going into the liferay code, it seems that the articleId is stored in the preferences of the portlet, and those are not accessible through a service.

I suppose I could get all the journal_contents of a group, iterate through them to get the preference on the article displayed, but I'm afraid that would be inefficient... Maybe there is no other way.

I hope there is something I am not seeing... sometimes it feels good to be wrong.

Best,
Alain
thumbnail
Aldo De Vleeschauwer,修改在11 年前。

RE: How to find web content displaying given article

Junior Member 帖子: 35 加入日期: 11-3-9 最近的帖子
I was looking for something similar and found:

http://www.liferay.com/community/forums/-/message_boards/message/10709084

List<long> hitLayoutIds = JournalContentSearchLocalServiceUtil.getLayoutIds(
articleDisplay.getGroupId(), false, articleDisplay.getArticleId()); 
if (hitLayoutIds.size() &gt; 0) {
Long hitLayoutId = hitLayoutIds.get(0);
Layout hitLayout = LayoutLocalServiceUtil.getLayout(
layout.getGroupId(), layout.isPrivateLayout(),
hitLayoutId.longValue());
layoutUrl = PortalUtil.getLayoutURL(hitLayout, themeDisplay);
}</long>
thumbnail
Alain Dresse,修改在11 年前。

RE: How to find web content displaying given article

Junior Member 帖子: 95 加入日期: 11-7-18 最近的帖子
Thank you Aldo !
exactly what I was looking for...

Best,
Alain