掲示板

Link to theme's image folder in Freemarker template?

9年前 に Scott Licata によって更新されました。

Link to theme's image folder in Freemarker template?

New Member 投稿: 5 参加年月日: 14/06/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
9年前 に Byrån Zaugg によって更新されました。

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

Expert 投稿: 252 参加年月日: 12/04/06 最新の投稿
I would have assumed it was
${themeDisplay.getPathThemeImages()}


Does that not work?
9年前 に Scott Licata によって更新されました。

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

New Member 投稿: 5 参加年月日: 14/06/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
9年前 に James Falkner によって更新されました。

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

Liferay Legend 投稿: 1399 参加年月日: 10/09/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
7年前 に Konrad Szeromski によって更新されました。

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

New Member 投稿: 16 参加年月日: 14/09/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">