![](/img/trans.png)
[英]how to get path Context without using themedisplay object in liferay
[英]Liferay 6.1 get themeDisplay in velocity (vm) file
我正在嘗試獲取用戶的個人資料圖片並將其顯示在liferay主題中。 到目前為止,我已經能夠通過速度$user
變量訪問User
對象。 用戶模型具有一個名為getPortraitUrl()
的方法,該方法將ThemeDisplay
作為參數。 我已經在liferay文檔中閱讀到,當使用主題時, themeDisplay
對象可以在運行時使用,但似乎無法實現。
我嘗試了幾種不同的方法來獲取themeDisplay
對象,但似乎都沒有用:
$theme
$themeDisplay
$request.get("theme-display")
$theme_display
...以及其他幾種不返回任何內容的方法。
$user.getPortraitUrl($themeDisplay)
是我想要實現的。
任何幫助將不勝感激
請注意正確的方法是getPortraitURL(ThemeDisplay themeDisplay)
, URL用大寫字母表示。
嘗試這個:
$user.getPortraitURL($themeDisplay)
您還應該能夠使用$themeDisplay
。
從速度訪問對象是所有生命線速度變量的有用鏈接。
您需要為ThemeDisplay使用的變量是
$ theme_display
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.