Fórumok
theme.runtime execute portlet inconsistently
Nisarg Parikh, módosítva 11 év-val korábban
theme.runtime execute portlet inconsistently
Expert Bejegyzések: 262 Csatlakozás dátuma: 2009.12.31. Legújabb bejegyzések
Hi,
I have created very simple portlet which contains only few lines of code.
I have added that in theme in such a way the it should only show in GUEST community for public pages. I have 2-3 pages.
#if ($themeDisplay.getLayout().getGroup().getName() == "guest" )
$theme.runtime("myportlet_INSTANCE_7XmA")
#end
On Home page theme calls the portlet perfectly but on other pages theme calls portlet only once. i.e. Going to Home page - it calls -> going to X page - it calls -> going to Home page - it calls -> going to X page - it does NOT call. So my functionality breaks.
Any idea why is this happening?
Thanks in advance for your help.
-Nisarg
I have created very simple portlet which contains only few lines of code.
I have added that in theme in such a way the it should only show in GUEST community for public pages. I have 2-3 pages.
#if ($themeDisplay.getLayout().getGroup().getName() == "guest" )
$theme.runtime("myportlet_INSTANCE_7XmA")
#end
On Home page theme calls the portlet perfectly but on other pages theme calls portlet only once. i.e. Going to Home page - it calls -> going to X page - it calls -> going to Home page - it calls -> going to X page - it does NOT call. So my functionality breaks.
Any idea why is this happening?
Thanks in advance for your help.
-Nisarg
Nisarg Parikh, módosítva 11 év-val korábban
RE: theme.runtime execute portlet inconsistently
Expert Bejegyzések: 262 Csatlakozás dátuma: 2009.12.31. Legújabb bejegyzések
It happens only if I am NOT login. If I am login, its works fine.
Do I need to specify any specific configuration on liferay-portlet.xml?
Do I need to specify any specific configuration on liferay-portlet.xml?
Nisarg Parikh, módosítva 11 év-val korábban
RE: theme.runtime execute portlet inconsistently
Expert Bejegyzések: 262 Csatlakozás dátuma: 2009.12.31. Legújabb bejegyzések
Hi All,
What I found is if user is not login then Liferay only calls the theme template once after that it might get that template from cache I suppose. I am not sure I am correct or not.
If this is the case then what should be the solution? I want in such a way that if user is not logged in then also my portlet (which is embedded in theme) should work properly.
Any help from Liferay team please?
Thank you.
-Nisarg
What I found is if user is not login then Liferay only calls the theme template once after that it might get that template from cache I suppose. I am not sure I am correct or not.
If this is the case then what should be the solution? I want in such a way that if user is not logged in then also my portlet (which is embedded in theme) should work properly.
Any help from Liferay team please?
Thank you.
-Nisarg
Nisarg Parikh, módosítva 11 év-val korábban
RE: theme.runtime execute portlet inconsistently
Expert Bejegyzések: 262 Csatlakozás dátuma: 2009.12.31. Legújabb bejegyzések
I have changed the implementation and it seems to be working now.
I have created one web content and adding that webcontent in theme by below code:
#set ($contentId = $propsUtil.get("cookie.header.content.id"))
$velocityPortletPreferences.setValue("portlet-setup-show-borders", "false")
$velocityPortletPreferences.setValue("group-id", "$group_id")
$velocityPortletPreferences.setValue("article-id", "$contentId")
$theme.runtime("56_INSTANCE_th00", "",$velocityPortletPreferences.toString())
$velocityPortletPreferences.reset()
And in theme's main.js I have added below logic in Liferay.Portlet.ready method:
Liferay.Portlet.ready(
/*
This function gets loaded after each and every portlet on the page.
portletId: the current portlet's id
node: the Alloy Node object of the current portlet
*/
function(portletId, node)
{
if(portletId == "56_INSTANCE_th00")
{
//logic of cookie name checking and hiding the DIV (node)
}
}
);
It seems to be working now. Still that portlet code is not working and I have not found any definite solution or answer for that.
Thanks.
-Nisarg
I have created one web content and adding that webcontent in theme by below code:
#set ($contentId = $propsUtil.get("cookie.header.content.id"))
$velocityPortletPreferences.setValue("portlet-setup-show-borders", "false")
$velocityPortletPreferences.setValue("group-id", "$group_id")
$velocityPortletPreferences.setValue("article-id", "$contentId")
$theme.runtime("56_INSTANCE_th00", "",$velocityPortletPreferences.toString())
$velocityPortletPreferences.reset()
And in theme's main.js I have added below logic in Liferay.Portlet.ready method:
Liferay.Portlet.ready(
/*
This function gets loaded after each and every portlet on the page.
portletId: the current portlet's id
node: the Alloy Node object of the current portlet
*/
function(portletId, node)
{
if(portletId == "56_INSTANCE_th00")
{
//logic of cookie name checking and hiding the DIV (node)
}
}
);
It seems to be working now. Still that portlet code is not working and I have not found any definite solution or answer for that.
Thanks.
-Nisarg