Foren

Home » Liferay Portal » English » 3. Development

Kombinierte Ansicht Flache Ansicht Baumansicht
Threads [ Zurück | Nächste ]
toggle
Akram MONCER
add javascript/image file to hook
19. November 2012 03:06
Antwort

Akram MONCER

Rang: Regular Member

Nachrichten: 106

Eintrittsdatum: 25. September 2012

Neue 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
Hitoshi Ozawa
RE: add javascript/image file to hook
19. November 2012 03:17
Antwort

Hitoshi Ozawa

Rang: Liferay Legend

Nachrichten: 7949

Eintrittsdatum: 23. März 2010

Neue 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
RE: add javascript/image file to hook
19. November 2012 03:21
Antwort

Akram MONCER

Rang: Regular Member

Nachrichten: 106

Eintrittsdatum: 25. September 2012

Neue Beiträge

thanks for your replay, i try your solution but don't work
Hitoshi Ozawa
RE: add javascript/image file to hook
19. November 2012 04:46
Antwort

Hitoshi Ozawa

Rang: Liferay Legend

Nachrichten: 7949

Eintrittsdatum: 23. März 2010

Neue 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
RE: add javascript/image file to hook
19. November 2012 05:47
Antwort

Akram MONCER

Rang: Regular Member

Nachrichten: 106

Eintrittsdatum: 25. September 2012

Neue 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
RE: add javascript/image file to hook
19. November 2012 06:05
Antwort

Akram MONCER

Rang: Regular Member

Nachrichten: 106

Eintrittsdatum: 25. September 2012

Neue 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