Foros de discusión

Link to theme's image folder in Freemarker template?

Scott Licata, modificado hace 9 años.

Link to theme's image folder in Freemarker template?

New Member Mensajes: 5 Fecha de incorporación: 16/06/14 Mensajes recientes
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, modificado hace 9 años.

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

Expert Mensajes: 252 Fecha de incorporación: 6/04/12 Mensajes recientes
I would have assumed it was
${themeDisplay.getPathThemeImages()}


Does that not work?
Scott Licata, modificado hace 9 años.

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

New Member Mensajes: 5 Fecha de incorporación: 16/06/14 Mensajes recientes
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, modificado hace 9 años.

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

Liferay Legend Mensajes: 1399 Fecha de incorporación: 17/09/10 Mensajes recientes
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, modificado hace 7 años.

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

New Member Mensajes: 16 Fecha de incorporación: 19/09/14 Mensajes recientes
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">