掲示板

Get Content of Entire Page without Theme by ID

thumbnail
13年前 に Brian Scott Schupbach によって更新されました。

Get Content of Entire Page without Theme by ID

Expert 投稿: 329 参加年月日: 08/10/23 最新の投稿
Is it possible to get the content only of a portlet page by passing a layout ID or something?

I've been looking and it seems that it is possible to get the content by using

ThemeDisplay.getPortletDisplay.getContent();

The problem I am facing is how do I get the correct ThemeDisplay for the page I want? I am not seeing a method that allows you to get ThemeDisplay by layout id unless I'm missing something...

any suggestions?
thumbnail
13年前 に Sandeep Nair によって更新されました。

RE: Get Content of Entire Page without Theme by ID

Liferay Legend 投稿: 1744 参加年月日: 08/11/06 最新の投稿
You can get themedisplay from request

(ThemeDisplay)req.getAttribute(WebKeys.THEME_DISPLAY);

Regards,
Sandeep
thumbnail
13年前 に Brian Scott Schupbach によって更新されました。

RE: Get Content of Entire Page without Theme by ID

Expert 投稿: 329 参加年月日: 08/10/23 最新の投稿
Yes, but how do I get the ThemeDisplay of a page that I am not currently on? Say, I want to get the ThemeDisplay for a specific users public page but display it in the portlet I'm creating. Is it possible to do that?
thumbnail
13年前 に Sandeep Nair によって更新されました。

RE: Get Content of Entire Page without Theme by ID

Liferay Legend 投稿: 1744 参加年月日: 08/11/06 最新の投稿
Hi,

Themedisplay available at any particular page is for that page only. This is created in ServicePreAction class. You can try creating a ThemeDisplay for the layout that you want seeing how its done in ServicePreAction.

Regards,
Sandeep
13年前 に Pankaj Sinha によって更新されました。

RE: Get Content of Entire Page without Theme by ID

Junior Member 投稿: 29 参加年月日: 10/04/26 最新の投稿
Hi Community..!!

Is there any way in which i can get the content of a page, i mean what are all the portlets that are there in that particular page...i have found somewhere that it can be fetched using some dynamic query, say, SELECT portletId FROM portletpreferences where plid = 10243, but then i am not quite getting the way to do this, Do u have any idea how to fetch this info..

Thanks & Warm Regards,
Pankaj
thumbnail
13年前 に Sandeep Nair によって更新されました。

RE: Get Content of Entire Page without Theme by ID

Liferay Legend 投稿: 1744 参加年月日: 08/11/06 最新の投稿
Hi,

Check this link

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

Regards,
Sandeep
13年前 に Pankaj Sinha によって更新されました。

RE: Get Content of Entire Page without Theme by ID

Junior Member 投稿: 29 参加年月日: 10/04/26 最新の投稿
Hi Sandeep,

First of all thanx for this swift response...

I went thru that link and found out these codes to be executed in order to get all the portlets present in the page...

Layout layout = LayoutLocalServiceUtil.getLayout(plid);
LayoutTypePortlet layoutTypePortlet = (LayoutTypePortlet)layout.getLayoutType();
List actualPortletList = layoutTypePortlet.getPortletIds();

But its showing error on "plid", how to get this "plid", is it layout id, if yes how to get the value for that..

Thanx once again,
Pankaj
thumbnail
13年前 に Sandeep Nair によって更新されました。

RE: Get Content of Entire Page without Theme by ID

Liferay Legend 投稿: 1744 参加年月日: 08/11/06 最新の投稿
Hi,

Try this,


ThemeDisplay themeDisplay = (ThemeDisplay)request.getAttribute(
			WebKeys.THEME_DISPLAY);

long plid = themeDisplay.getPlid();


Regards,
Sandeep
13年前 に Pankaj Sinha によって更新されました。

RE: Get Content of Entire Page without Theme by ID

Junior Member 投稿: 29 参加年月日: 10/04/26 最新の投稿
Thanks a lot Sandeep,

Its working wonders...This is my final code..

  
    List actualPortletList = null;
    ThemeDisplay themeDisplay = (ThemeDisplay)request.getAttribute(WebKeys.THEME_DISPLAY);
    long plid = themeDisplay.getPlid();
    Layout layout = LayoutLocalServiceUtil.getLayout(plid);
    LayoutTypePortlet layoutTypePortlet = (LayoutTypePortlet)layout.getLayoutType();
    actualPortletList = layoutTypePortlet.getPortletIds();



Ofcourse with proper imports..

Thank a lot once again..

Regards,
Pankaj
13年前 に Pankaj Sinha によって更新されました。

RE: Get Content of Entire Page without Theme by ID

Junior Member 投稿: 29 参加年月日: 10/04/26 最新の投稿
Hi Sandeep,

By trying the above code,m getting the list of portlets present on that page, but in some form which is not quite readable. for example if the name of the portlet is "link1", then it as being displayed as "link1_WAR_link1portlet_INSTANCE_G7g"..How can i get the portlet real names.. please help..

Thanks & regards..
Pankaj
thumbnail
13年前 に Sandeep Nair によって更新されました。

RE: Get Content of Entire Page without Theme by ID

Liferay Legend 投稿: 1744 参加年月日: 08/11/06 最新の投稿
Hi,

Try this

List<Portlet> portlets = layoutTypePortlet.getPortlets();

for(Portlet portlet : portlets){
System.out.println(portlet.getPortletName());
}

You can get other things from this portlet object.

Regards,
Sandeep