Vista combinada Visión Plana Vista de árbol
Discusiones [ Anterior | Siguiente ]
Paul Franky
Using #js() in velocity template
23 de marzo de 2010 9:03

Paul Franky

Ranking: New Member

Mensajes: 8

Fecha de incorporación: 11 de diciembre de 2009

Mensajes recientes


We're using following code inside our custom velocity template:


The resulting html code works just fine except its empty id attribute:

1<script id="" src="/our-theme/javascript/my-javascript.js" type="text/javascript"></script>

Is it required by Liferay? How should we set it? Could we delete it?
Doe Del
RE: Using #js() in velocity template
2 de marzo de 2012 7:48

Doe Del

Ranking: New Member

Mensajes: 1

Fecha de incorporación: 2 de marzo de 2012

Mensajes recientes

Hi Paul,

I just ran into the same issue.

As far as I can tell, the LR-guys created a macro called "#js()" in the velocity file "VM_liferay.vm".

There is another macro for css files as well.

This macro is used internally by liferay and set's the script's ID to "mainLiferayThemeJavaScript" if the filename is "$js_main_file" and leaves it empty otherwise.

But: You are not forced to use this macro, you can do what the macro does by writing:

<script id="foo" src="/path/to/bar.js" type="text/javascript" />

instead of:


Participate in the State of Liferay Community 2017. Help the community and even win some prizes!