Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
raghu raghu
Remove a portlet programmatic from one page
December 30, 2013 4:50 AM
Answer

raghu raghu

Rank: New Member

Posts: 4

Join Date: November 2, 2011

Recent Posts

Hi All,

I have two page let home and welcome with portlet A in common.

I would like to remove portlet A from home page .it should automatically remove from the portlet from welcome page.

Could you please suggest some approach to solve this issue.


Anticipating an early response.


Thanks in Advance.
Raghu
Subhash Pavuskar
RE: Remove a portlet programmatic from one page
December 30, 2013 7:19 AM
Answer

Subhash Pavuskar

Rank: Regular Member

Posts: 234

Join Date: March 12, 2012

Recent Posts

Hi,

Below Snippet is the sample code to remove portlet problematically !! Hope it may help you !!

 1<%@ include file="/html/common/init.jsp" %>
 2<portlet:defineObjects />
 3<%
 4   Portlet portlet = (Portlet)request.getAttribute(WebKeys.RENDER_PORTLET);
 5   PortletPreferences portletSetup = PortletPreferencesFactoryUtil.getLayoutPortletSetup(layout, portletDisplay.getId());
 6%>
 7
 8<c:if test="<%= portletDisplay.isShowCloseIcon() %>">
 9<span class="portlet-close">
10  [color=#FF0000]<a href="<%= portletDisplay.getURLClose() %>"><liferay-ui:message key="close" /></a>[/color]
11</span>
12</c:if>
raghu raghu
RE: Remove a portlet programmatic from one page
January 2, 2014 5:39 AM
Answer

raghu raghu

Rank: New Member

Posts: 4

Join Date: November 2, 2011

Recent Posts

Subhash Pavuskar:
Hi,

Below Snippet is the sample code to remove portlet problematically !! Hope it may help you !!

 1<%@ include file="/html/common/init.jsp" %>
 2<portlet:defineObjects />
 3<%
 4   Portlet portlet = (Portlet)request.getAttribute(WebKeys.RENDER_PORTLET);
 5   PortletPreferences portletSetup = PortletPreferencesFactoryUtil.getLayoutPortletSetup(layout, portletDisplay.getId());
 6%>
 7
 8<c:if test="<%= portletDisplay.isShowCloseIcon() %>">
 9<span class="portlet-close">
10  [color=#FF0000]<a href="<%= portletDisplay.getURLClose() %>"><liferay-ui:message key="close" /></a>[/color]
11</span>
12</c:if>




Thanks for your response.

But my question is different.Please have a look and suggest.
Any suggestion is highly appreciable.
Thanks