Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Trollbahrt Wunderlich
How to put Portlets on my Pages? (RESOLVED)
December 11, 2007 3:35 AM
Answer

Trollbahrt Wunderlich

Rank: Junior Member

Posts: 70

Join Date: June 11, 2007

Recent Posts

Hi,

I have some pages in my community and I want to customize all this pages from the backend system. Is there any method to add portlets to a specific page? I imagine that it looks like

MyUnknownClass.addPortlet(<portletid>,<communityid>,<pageid>)


is there any way that works?

best
Troll
Roman Hoyenko
RE: How to put Portlets on my Pages?
November 20, 2007 9:54 AM
Answer

Roman Hoyenko

Rank: Liferay Master

Posts: 868

Join Date: October 8, 2007

Recent Posts

Here you go:
(from here: liferay\portal\portal-ejb\src\com\liferay\portal\action\UpdateLayoutAction.java )
 1
 2
 3        Layout layout = (Layout)req.getAttribute(WebKeys.LAYOUT);
 4
 5        LayoutTypePortlet layoutTypePortlet =
 6            (LayoutTypePortlet)layout.getLayoutType();
 7
 8        String cmd = ParamUtil.getString(req, Constants.CMD);
 9
10        String portletId = ParamUtil.getString(req, "p_p_id");
11
12        if (cmd.equals(Constants.ADD)) {
13            portletId = layoutTypePortlet.addPortletId(
14                req.getRemoteUser(), portletId);
15        }