Foren

add javascript/image file to hook

Akram MONCER, geändert vor 11 Jahren.

add javascript/image file to hook

Regular Member Beiträge: 106 Beitrittsdatum: 25.09.12 Neueste Beiträge
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, geändert vor 11 Jahren.

RE: add javascript/image file to hook

Liferay Legend Beiträge: 7942 Beitrittsdatum: 24.03.10 Neueste Beiträge
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, geändert vor 11 Jahren.

RE: add javascript/image file to hook

Regular Member Beiträge: 106 Beitrittsdatum: 25.09.12 Neueste Beiträge
thanks for your replay, i try your solution but don't work
thumbnail
Hitoshi Ozawa, geändert vor 11 Jahren.

RE: add javascript/image file to hook

Liferay Legend Beiträge: 7942 Beitrittsdatum: 24.03.10 Neueste Beiträge
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, geändert vor 11 Jahren.

RE: add javascript/image file to hook

Regular Member Beiträge: 106 Beitrittsdatum: 25.09.12 Neueste Beiträge
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, geändert vor 11 Jahren.

RE: add javascript/image file to hook

Regular Member Beiträge: 106 Beitrittsdatum: 25.09.12 Neueste Beiträge
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