Liferay 6.2中的当前站点URL

时间:2014-03-05 15:11:26

标签: url liferay

我无法弄清楚如何在Liferay中获取当前网站的网址。例如,如果我创建了四个网站 - site1,site2,site3,site4。这些网站的网址为:

http://localhost:8080/web/site1/
http://localhost:8080/web/site2/
http://localhost:8080/web/site3/
http://localhost:8080/web/site4/

但是如何从速度(主题)中获取此URL?我尝试了几个选项:

$themeDisplay.getPathFriendlyURLPublic() - /web
$themeDisplay.getPortalURL()             - http://localhost:8080
$themeDisplay.getURLHome()               - http://localhost:8080/web/guest
$themeDisplay.getURLCurrent()            - /web/site1/home

我需要得到http://localhost:8080/web/actualsite/

2 个答案:

答案 0 :(得分:3)

好的,经过几个小时的尝试,我找到了解决方案:

要获取当前网站网址,您需要使用:

$ layout.getGroup()。friendlyURL in velocity。

此表达式返回'/ site-name'格式。

答案 1 :(得分:0)

在你的主题vm中试试这个。这应该给你当前完整的网址。

$portalUtil.getCurrentCompleteURL($request)

Output : http://localhost:8080/web/site4/home
相关问题