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

Paul Franky

Ranking: New Member

Mensajes: 8

Fecha de incorporación: 11 de diciembre de 2009

Mensajes recientes

Hi!

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

1#js("$javascript_folder/my-javascript.js")


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
Respuesta

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:

#js("/path/to/bar.js")