Foros de discusión

add javascript/image file to hook

Akram MONCER, modificado hace 11 años.

add javascript/image file to hook

Regular Member Mensajes: 106 Fecha de incorporación: 25/09/12 Mensajes recientes
hi
can anyone help, i want to add some js file and image in my hook projetct i test a simple reference like in html "<img src="/image/img/png"/> but i didn't work
thanks
thumbnail
Hitoshi Ozawa, modificado hace 11 años.

RE: add javascript/image file to hook

Liferay Legend Mensajes: 7942 Fecha de incorporación: 24/03/10 Mensajes recientes
You have to prepend portlet name to the url of the file. It's possible to manually enter the portlet name, but the common practice is to dynamically insert it as below:
<img src="<%= request.getContextPath() %>/image/img/image.png" />
Akram MONCER, modificado hace 11 años.

RE: add javascript/image file to hook

Regular Member Mensajes: 106 Fecha de incorporación: 25/09/12 Mensajes recientes
thanks for your replay, i try your solution but don't work
thumbnail
Hitoshi Ozawa, modificado hace 11 años.

RE: add javascript/image file to hook

Liferay Legend Mensajes: 7942 Fecha de incorporación: 24/03/10 Mensajes recientes
Sorry, you were creating a hook and not a portlet.
Where is the image located? In the ROOT\html\icons or in your hook? Have you tried hard-coding the portlet name.

Try
img src="/html/icons/admin_server.png"
Akram MONCER, modificado hace 11 años.

RE: add javascript/image file to hook

Regular Member Mensajes: 106 Fecha de incorporación: 25/09/12 Mensajes recientes
your solution works but i want to put the image in the hook and not in the icons file, and it's a hook for the shopping portlet
Akram MONCER, modificado hace 11 años.

RE: add javascript/image file to hook

Regular Member Mensajes: 106 Fecha de incorporación: 25/09/12 Mensajes recientes
thank you very much for giving me the solution i just have to put all the path to the image it mean : /html/..../image.png