Foros de discusión

Loading a common javascript file

Navein Austin Fernandes, modificado hace 15 años.

Loading a common javascript file

New Member Mensajes: 2 Fecha de incorporación: 23/06/08 Mensajes recientes
Hi, I am using Liferay Enterprise Portal 4.4.2. I have a requirement wherein I need to load a common javascript file to the portal. This will be accessed by all portlets.

I did refer to link - http://wiki.liferay.com/index.php/Including_Javascript_/_JS_Files_in_a_portlets, but did not seem to work. Any way it is to include a link to all portlets.

Does anyone know how i can achieve this. The reason is that there is a common variable that all portlets need to refer to and some scripts that work on this variable.

I would really be helpful for a solution.

Thanks.
thumbnail
Thiago Moreira, modificado hace 15 años.

RE: Loading a common javascript file

Liferay Legend Mensajes: 1449 Fecha de incorporación: 10/10/07 Mensajes recientes
Hi Navein,

Take a look at the JavaScript section of the portal.properties file. There you will find more information on how to add js files to the portal page.

Cheers
thumbnail
Juanjo Hernández Cánovas, modificado hace 15 años.

RE: Loading a common javascript file

Regular Member Mensajes: 183 Fecha de incorporación: 11/08/08 Mensajes recientes
Navein Austin Fernandes:
Hi, I am using Liferay Enterprise Portal 4.4.2. I have a requirement wherein I need to load a common javascript file to the portal. This will be accessed by all portlets.

I did refer to link - http://wiki.liferay.com/index.php/Including_Javascript_/_JS_Files_in_a_portlets, but did not seem to work. Any way it is to include a link to all portlets.

Does anyone know how i can achieve this. The reason is that there is a common variable that all portlets need to refer to and some scripts that work on this variable.

I would really be helpful for a solution.

Thanks.


Hello Navein, Have you resolve this issue? I also failed to introduce custom javascript by following the paradigm ${easyconf:companyId}.properties.

Thanks for your help

Greetings

Juanjo
Navein Austin Fernandes, modificado hace 14 años.

RE: Loading a common javascript file

New Member Mensajes: 2 Fecha de incorporación: 23/06/08 Mensajes recientes
I kind of did it but in a different way which might not be right. The theme of the portal has a portal_normal.vm. I added my script files in this just below the </head> tag. So now it is accessible through out the portal.
If anyone has got some other way of doing it please let me know.

thanks.
Brahim TARNAOUI, modificado hace 13 años.

RE: Loading a common javascript file

Junior Member Mensajes: 64 Fecha de incorporación: 15/06/10 Mensajes recientes
hi,


please how can'i include a javascript file in my jsp ovveriden by hook, my jsp it's week.jspf from calendar portlet.


thx
thumbnail
prakash harigopal, modificado hace 13 años.

RE: Loading a common javascript file

Regular Member Mensajes: 101 Fecha de incorporación: 23/06/10 Mensajes recientes
It is pretty simple.... Use the import tag

&lt;%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %&gt; 
<c:import url="../../dojo/dojo-1.3rc1/dojo/dojo.js" />



thanks
prakash.
Brahim TARNAOUI, modificado hace 13 años.

RE: Loading a common javascript file

Junior Member Mensajes: 64 Fecha de incorporación: 15/06/10 Mensajes recientes
hello,

i use the same code, but is not working,
NB:i use a hook, the tree of my app is bellow on image.
my javascript is in WEB-INF/js/functions.js ou in calendar/js/functions.js
this is my code added in view.jsp page.

&lt;%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %&gt; 
<c:import url="/js/functions.js" />




thx in advance

Archivos adjuntos: