Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Nono Carballo
Getting layout info from a portlet
February 27, 2013 8:19 AM
Answer

Nono Carballo

Rank: New Member

Posts: 16

Join Date: June 25, 2012

Recent Posts

Hi!

How can I get inside a portlet the layout the page is using, I mean, how many columns the layout has and what is the position of the portlet in the layout (what column the portlet is)?

Thanks

Nono
Sandeep Nair
RE: Getting layout info from a portlet
February 27, 2013 10:05 AM
Answer

Sandeep Nair

Rank: Liferay Legend

Posts: 1732

Join Date: November 5, 2008

Recent Posts

Hi,

You should be getting typeSettings which can have the information. You can get typeSettings from Layout.

You would be doing it something like this.

1
2ThemeDisplay themeDisplay = (ThemeDisplay)request.getAttribute(Webkeys.ThemeDisplay);
3
4Layout layout = themeDisplay.getLayout();
5
6String typeSettings = layout.getTypeSettings();


Regards,
Sandeep
Nono Carballo
RE: Getting layout info from a portlet
February 27, 2013 11:18 AM
Answer

Nono Carballo

Rank: New Member

Posts: 16

Join Date: June 25, 2012

Recent Posts

Sandeep Nair:
Hi,

You should be getting typeSettings which can have the information. You can get typeSettings from Layout.

You would be doing it something like this.

1
2ThemeDisplay themeDisplay = (ThemeDisplay)request.getAttribute(Webkeys.ThemeDisplay);
3
4Layout layout = themeDisplay.getLayout();
5
6String typeSettings = layout.getTypeSettings();


Regards,
Sandeep


I need to set up the users public and private pages of a liferay instance, but the portlets in those pages are not the same for all users.

So I need a portlet that embeed another portlet according it´s position in the layout, the owner of the layout and the roles of the owner. Let say, if the portlet is the first portlet in the left column, and the owner in U1 and have the role R1 then embeed portlet A, and so. The rules could be written using drools or some similar tool.