Foren

Create-account URL in Velocity template (Liferay 6.1)

Thibault Boyeux, geändert vor 12 Jahren.

Create-account URL in Velocity template (Liferay 6.1)

New Member Beiträge: 12 Beitrittsdatum: 27.07.09 Neueste Beiträge
Hello everyone,

In Liferay 6.1, you can no longer do themeDisplay.getURLCreateAccount() to create a link towards the account creation page in your Velocity theme template.

Indeed, the method has been removed from the ThemeDisplay API.

How could I include this link within my theme Velocity template now that this is not available any longer?

Thank you very much for your help!
thumbnail
Sandeep Nair, geändert vor 12 Jahren.

RE: Create-account URL in Velocity template (Liferay 6.1)

Liferay Legend Beiträge: 1744 Beitrittsdatum: 06.11.08 Neueste Beiträge
Hi,

Can you try like this in your vm

#set ($create_account_url = $portletURLFactory.create($request, "58", $page.getPlid(), "ACTION_PHASE"))
$create_account_url.setWindowState(WindowState.MAXIMIZED);
$create_account_url.setPortletMode(PortletMode.VIEW);
$create_account_url.setParameter("saveLastPath", "0");
$create_account_url.setParameter("struts_action", "/login/create_account");

and then use $create_account_url

Regards,
Sandeep
Thibault Boyeux, geändert vor 12 Jahren.

RE: Create-account URL in Velocity template (Liferay 6.1)

New Member Beiträge: 12 Beitrittsdatum: 27.07.09 Neueste Beiträge
Hi Sandeep,

Thank you very much for your precious help. I didin't know one could PortletURLFactory in Velocity (I should have checked the VelocityVariables file, my mistake).

I ended up using this code:

#set ($create_account_url = $portletURLFactory.create($request, "58", $page.getPlid(), "ACTION_PHASE"))
$create_account_url.setWindowState("maximized")
$create_account_url.setPortletMode("view")
$create_account_url.setParameter("saveLastPath", "0")
$create_account_url.setParameter("struts_action", "/login/create_account")


Indeed, Velocity cannot easily retrieve static constants from Java classes (or I don't know how), such as WindowState.MAXIMIZED and PortletMode.VIEW.

It is not optimal to write them directly as strings, but I think the string values of these two constants shouldn't change soon!


Best,
Thibault.
thumbnail
Tanaji M. Londhe, geändert vor 11 Jahren.

RE: Create-account URL in Velocity template (Liferay 6.1)

Regular Member Beiträge: 194 Beitrittsdatum: 25.04.12 Neueste Beiträge
Hi,

Liferay 6.1 version does not support "themeDisplay.getURLCreateAccount()" ,so I used following code as it is in my vm file but cant work
#set ($create_account_url = $portletURLFactory.create($request, "58", $page.getPlid(), "ACTION_PHASE"))
$create_account_url.setWindowState(WindowState.MAXIMIZED);
$create_account_url.setPortletMode(PortletMode.VIEW);
$create_account_url.setParameter("saveLastPath", "0");
$create_account_url.setParameter("struts_action", "/login/create_account");

So please anybody tell me link for Create-Account URL for liferay 6.1
thumbnail
Sandeep Nair, geändert vor 11 Jahren.

RE: Create-account URL in Velocity template (Liferay 6.1)

Liferay Legend Beiträge: 1744 Beitrittsdatum: 06.11.08 Neueste Beiträge
Dont use WindowState or PortletMode, use the string values directly as

$create_account_url.setWindowState("maximized")
$create_account_url.setPortletMode("view")
thumbnail
Tanaji M. Londhe, geändert vor 11 Jahren.

RE: Create-account URL in Velocity template (Liferay 6.1)

Regular Member Beiträge: 194 Beitrittsdatum: 25.04.12 Neueste Beiträge
Hi Sandeep,
I make changes as per your suggestion but generates url this one "http://localhost:9090/create_account_url" , So what is issue i cant find out.

#set ($create_account_url = $portletURLFactory.create($request, "58", $page.getPlid(), "ACTION_PHASE"))
$create_account_url.setWindowState("maximized");
$create_account_url.setPortletMode("view");
$create_account_url.setParameter("saveLastPath", "0");
$create_account_url.setParameter("struts_action", "/login/create_account");

<a href="create_account_url">Register</a>

It throughs exception : 07:25:04,140 INFO [PortalImpl:4873] Current URL /create_account_url generates exception: null



Thanks & regards,
Tanaji Londhe.
thumbnail
Sandeep Nair, geändert vor 11 Jahren.

RE: Create-account URL in Velocity template (Liferay 6.1)

Liferay Legend Beiträge: 1744 Beitrittsdatum: 06.11.08 Neueste Beiträge
You havent used the variable in anchor tag properly. Please put $
<a href="$create_account_url">Register</a>
thumbnail
Tanaji M. Londhe, geändert vor 11 Jahren.

RE: Create-account URL in Velocity template (Liferay 6.1)

Regular Member Beiträge: 194 Beitrittsdatum: 25.04.12 Neueste Beiträge
Hi Sandeep,

Sorry I forgot to write "$" in vm file. Thanx it works properly.
Sylvain Fournier, geändert vor 11 Jahren.

RE: Create-account URL in Velocity template (Liferay 6.1)

New Member Beitrag: 1 Beitrittsdatum: 19.07.12 Neueste Beiträge
How do you manage multi language for your label "Register"
thumbnail
Pablo Rendón, geändert vor 11 Jahren.

RE: Create-account URL in Velocity template (Liferay 6.1)

New Member Beiträge: 8 Beitrittsdatum: 29.12.11 Neueste Beiträge
Hello,

I'm trying to get the categories with the link in a VM template, but I can't even make this works, this is what I'm doing:

#set ($create_account_url = $portletURLFactory.create($request, "58", $page.getPlid(), "ACTION_PHASE"))
$create_account_url.setWindowState("maximized");
$create_account_url.setPortletMode("view");
$create_account_url.setParameter("saveLastPath", "0");
$create_account_url.setParameter("struts_action", "/login/create_account");

<a href="$create_account_url">Register</a>

and I have a link like "http://localhost:8080/web/guest/$thisportlet_url"
I think is a problem related with the $page, because when I try to render the $page.getPlid() I just get "$page.getPlid()" instead of the value, I've modified the portal-ext.properties to add "journal.template.velocity.restricted.variables=" but still doesn't work emoticon

any clue what I'm doing wrong?

Thank you!
thumbnail
Durgaprasad Lagadapati, geändert vor 11 Jahren.

RE: Create-account URL in Velocity template (Liferay 6.1)

New Member Beiträge: 10 Beitrittsdatum: 25.05.12 Neueste Beiträge
Can we use LoginUtil.getURLCreateAccount(request,themeDisplay) as suggested in http://www.liferay.com/community/wiki/-/wiki/Main/Upgrade+6.0+plugins+to+6.1?
John Carter, geändert vor 11 Jahren.

RE: Create-account URL in Velocity template (Liferay 6.1)

Junior Member Beiträge: 53 Beitrittsdatum: 18.10.12 Neueste Beiträge
Durgaprasad Lagadapati:
Can we use LoginUtil.getURLCreateAccount(request,themeDisplay) as suggested in http://www.liferay.com/community/wiki/-/wiki/Main/Upgrade+6.0+plugins+to+6.1?


Durgaprasad,
I have checked the LoginUtil class in LR6.1.1 GA2 there is no such method,but if it's about account url for the login user then you can use
"$theme_display.getURLMyAccount()"

in theme .
Beppo Ivel, geändert vor 9 Jahren.

RE: Create-account URL in Velocity template (Liferay 6.1)

Regular Member Beiträge: 112 Beitrittsdatum: 09.04.14 Neueste Beiträge
I also tried to build a URL but in I use freemarker template. My question is how I get the variable ${page}? If I try to call:

&lt;#assign updateURL = portletURLFactory.create(request,"169_INSTANCE_X4hfOUKZyDvi", page.getPlid() ,"RENDER_PHASE")&gt;


I get the error:

Expression page is undefined on line 55, column 122 in 10157#10197#11814.
thumbnail
Sandeep Nair, geändert vor 9 Jahren.

RE: Create-account URL in Velocity template (Liferay 6.1)

Liferay Legend Beiträge: 1744 Beitrittsdatum: 06.11.08 Neueste Beiträge
Replace "page" with "layout".

Regards,
Sandeep
Sriram Moola, geändert vor 11 Jahren.

RE: Create-account URL in Velocity template (Liferay 6.1)

New Member Beiträge: 2 Beitrittsdatum: 20.07.12 Neueste Beiträge
HI Sandeep,

I've followed your steps in creating account url in velocity template. The url is generating fine, but the problem i'm facing is with a parameter p_p_lifecyle. Below is the url

http://localhost:8080/home?p_auth=1KMIMM5l&p_p_id=58&p_p_lifecycle=1&p_p_state=maximized&p_p_mode=view&saveLastPath=0&_58_struts_action=%2Flogin%2Fcreate_account

It's giving me Sigin is temporarily not available. When i change the p_p_lifecylcle paramter value to 0, it's working fine so can you please suggest me what should i do to set p_p_lifecycle parameter.
Sriram Moola, geändert vor 11 Jahren.

RE: Create-account URL in Velocity template (Liferay 6.1)

New Member Beiträge: 2 Beitrittsdatum: 20.07.12 Neueste Beiträge
Hi Guys,

I've found the solution for my issue, using RENDER_PHASE instead of ACTION_PHASE fixed the issue.
Beppo Ivel, geändert vor 9 Jahren.

RE: Create-account URL in Velocity template (Liferay 6.1)

Regular Member Beiträge: 112 Beitrittsdatum: 09.04.14 Neueste Beiträge
I already used RENDER_PHASE, I was looking for themeDisplay.getPlid(). Do you know how to get the themeDisplay.getPortletDisplay().getId()? This question is related to this thread.