掲示板
Link to Page to Redirect Users to Their Own Personal Site
6年前 に Karl Chin によって更新されました。
Link to Page to Redirect Users to Their Own Personal Site
Junior Member 投稿: 28 参加年月日: 16/10/05 最新の投稿
Hi Experts,
In designing Liferay site, how can we create a page in the Global Public Site using "Link to Page" to redirect users to their own personal site, for instance, to "My Dashboard"?
I have tried the following but no luck, please help.
https://www.example.com/user/${liferay:screenName}
All the best,
Karl Chin
In designing Liferay site, how can we create a page in the Global Public Site using "Link to Page" to redirect users to their own personal site, for instance, to "My Dashboard"?
I have tried the following but no luck, please help.
https://www.example.com/user/${liferay:screenName}
All the best,
Karl Chin
6年前 に Massimo Bevilacqua によって更新されました。
RE: Link to Page to Redirect Users to Their Own Personal Site (回答)
Regular Member 投稿: 210 参加年月日: 16/12/27 最新の投稿
Hi,
I tried in this way and it works:
You can also use this to redirect to user account page:
I tried in this way and it works:
<#assign linkUrl = themeDisplay.getPortalURL() />
<#assign screenName = themeDisplay.getUser().screenName />
<a href="${linkUrl}/user/${screenName}">My Dashboard</a>
You can also use this to redirect to user account page:
<a href="${themeDisplay.getURLMyAccount()}">My account </a>
6年前 に Karl Chin によって更新されました。
RE: Link to Page to Redirect Users to Their Own Personal Site
Junior Member 投稿: 28 参加年月日: 16/10/05 最新の投稿
Hi Massimo,
Thanks for your reply. What are the exact steps for implementing the solution you used?
From your code, I think your approach is to do customization on a theme on some FreeMarker files (*.ftl).
Would there be a simpler way to achieve this? Thank you.
All the best,
Karl Chin
Thanks for your reply. What are the exact steps for implementing the solution you used?
From your code, I think your approach is to do customization on a theme on some FreeMarker files (*.ftl).
Would there be a simpler way to achieve this? Thank you.
All the best,
Karl Chin
6年前 に Massimo Bevilacqua によって更新されました。
RE: Link to Page to Redirect Users to Their Own Personal Site (回答)
Regular Member 投稿: 210 参加年月日: 16/12/27 最新の投稿
Hi Karl,
I don't know if there is a simple way to do it.
For my solution you can do in one of these ways:
1)If you are using one custom theme insert the my code inside one .ftl file inside "templates" folder, maybe portal_normal.ftl (where do you want to display the "my dashboard" button?)
2)For my tests I putted the code inside an Application display templates(ADT) because there I have "themeDisplay" available"
3) you can put the code inside a web content template, but you need to retrive "themeDisplay" in this way:
Remember if you want to use "static util" or others liferay service you need to delete in
Control panel -> System settings -> Foundation -> Freemarker engine
the Restricted variables (a server restart is required after that.
If you need help let me know
Best regards
Massimo
I don't know if there is a simple way to do it.
For my solution you can do in one of these ways:
1)If you are using one custom theme insert the my code inside one .ftl file inside "templates" folder, maybe portal_normal.ftl (where do you want to display the "my dashboard" button?)
2)For my tests I putted the code inside an Application display templates(ADT) because there I have "themeDisplay" available"
3) you can put the code inside a web content template, but you need to retrive "themeDisplay" in this way:
<#assign serviceContext = staticUtil["com.liferay.portal.kernel.service.ServiceContextThreadLocal"].getServiceContext()>
<#assign themeDisplay = serviceContext.getThemeDisplay() />
<#assign linkUrl = themeDisplay.getPortalURL() />
<#assign screenName = themeDisplay.getUser().screenName />
<a href="${linkUrl}/user/${screenName}">My Dashboard</a>
Remember if you want to use "static util" or others liferay service you need to delete in
Control panel -> System settings -> Foundation -> Freemarker engine
the Restricted variables (a server restart is required after that.
If you need help let me know
Best regards
Massimo