留言板

Link to theme's image folder in Freemarker template?

Scott Licata,修改在9 年前。

Link to theme's image folder in Freemarker template?

New Member 帖子: 5 加入日期: 14-6-16 最近的帖子
I'm new to Freemarker and I can't figure out how to properly link to an image that's inside the themes image folder. I know in the theme using Velocity you can use $themeDisplay.getPathThemeImages(), is there something similar for Freemarker that I can use in a template?
thumbnail
Byrån Zaugg,修改在9 年前。

RE: Link to theme's image folder in Freemarker template?

Expert 帖子: 252 加入日期: 12-4-6 最近的帖子
I would have assumed it was
${themeDisplay.getPathThemeImages()}


Does that not work?
Scott Licata,修改在9 年前。

RE: Link to theme's image folder in Freemarker template?

New Member 帖子: 5 加入日期: 14-6-16 最近的帖子
It gives me an error for themeDisplay being undefined.

While the template is Freemarker the theme is Velocity so I thought that was causing the issue but I still can't figure it out.
thumbnail
James Falkner,修改在9 年前。

RE: Link to theme's image folder in Freemarker template?

Liferay Legend 帖子: 1399 加入日期: 10-9-17 最近的帖子
Scott Licata:
It gives me an error for themeDisplay being undefined.

While the template is Freemarker the theme is Velocity so I thought that was causing the issue but I still can't figure it out.


Are you trying to do this from a Web Content Template? If so, then themeDisplay isn't a "real" ThemeDisplay object - it's just a HashMap of interesting and useful bits from what would be the "real" ThemeDisplay object. So you could do this:
<#assign imagePath = getterUtil.getString(request['theme-display']['path-image']) />
thumbnail
Konrad Szeromski,修改在7 年前。

RE: Link to theme's image folder in Freemarker template?

New Member 帖子: 16 加入日期: 14-9-19 最近的帖子
This thread always comes up when I'm looking how to embed theme's image or icon from images (not: image) directory into Freemarker's Web Content Template.

In such case I'm using:

<#assign imagesPath = getterUtil.getString(request['theme-display']['path-theme-images']) />
<img src="${imagesPath}/common/date.png">