Display portlet as popup in theme

Step 1: Open the portal-normal.vm file and write the below code.

 portal-normal.vm 

#set ($popupUrl = $portletURLFactory.create($request,"login_WAR_portlet",$page.getPlid(), "RENDER_PHASE"))
$popupUrl .setParameter("p_p_state", "exclusive")
$popupUrl .setPortletMode("view") 


 <a href="#" onClick = "showPopup()">Show Popup </a>

where 'login_WAR_portlet' is the portlet name.

  
Step 2: Write the javascript code for popup in portal-normal.vm or any other .js file.



<aui:script>
AUI().use('aui-base',
'aui-io-plugin-deprecated',
'liferay-util-window',
function(A) {
function showPopup(){
var popUpWindow=Liferay.Util.Window.getWindow(
{
dialog: {
centered: true,
constrain2view: true,
//cssClass: 'yourCSSclassName',
modal: true,
resizable: false,
width: 475
}
}
).plug(
A.Plugin.IO,
{
autoLoad: false
}).render();
popUpWindow.show();
popUpWindow.titleNode.html("Liferay 6.2 Dialog Window");
popUpWindow.io.set('uri','$popupUrl');
popUpWindow.io.start();
}
});
</aui:script>

Step 3: Open liferay-portlet.xml add the following line.

<add-default-resource>true</add-default-resource>

Comments

  1. Impressed alot.I really like your blog.Thanks for the post. Pop up System Services in Malaysia

    ReplyDelete
  2. The blog was absolutely fantastic! Lot of information is helpful in some or the other way. Keep updating the blog, looking forward for more content...Great job, keep it up.
    Pop Up System services in Malaysia

    ReplyDelete
  3. Really nice info you posted thanks for sharing this with us. We provide Pop Up strategies.

    ReplyDelete

Post a Comment

Popular posts from this blog

Liferay 7 overriding MVC Commands

Liferay migration to version 7.x

Liferay Popups