Foros de discusión
import js file
Filip Puškáš, modificado hace 9 años.
import js file
Regular Member Mensajes: 238 Fecha de incorporación: 11/12/14 Mensajes recientes
How can I import a javascript file ?
I tried to put this line in portal_normal.vm
, my_script.js I put in ../my_theme/docroot/js/my_script.js ... and ... in this file I write simple test code
but it not work ... can you tell me where did I a mistake? Thanks o lot :-)
I tried to put this line in portal_normal.vm
<script type="text/javascript" src="$javascript_folder/my_script.js" charset="utf-8"></script>
, my_script.js I put in ../my_theme/docroot/js/my_script.js ... and ... in this file I write simple test code
window.alert("Heureka :-)");
but it not work ... can you tell me where did I a mistake? Thanks o lot :-)
Ravi Kumar Gupta, modificado hace 9 años.
RE: import js file
Liferay Legend Mensajes: 1302 Fecha de incorporación: 24/06/09 Mensajes recientes
There should be _diff folder. All your custom code should go there.
Please check in your deployed theme location(webapps/your-theme-folder) if portal_normal.vm file contains the code you added. And also see if your script file is present in js folder.
Please check in your deployed theme location(webapps/your-theme-folder) if portal_normal.vm file contains the code you added. And also see if your script file is present in js folder.
Filip Puškáš, modificado hace 9 años.
RE: import js file
Regular Member Mensajes: 238 Fecha de incorporación: 11/12/14 Mensajes recientes
Yes, they contains all code ... and just for sure I created in _diffs a copy of all files ( /js/script.js + /templates/portal_noraml.vm ) ... but no change :-(
Jitendra Rajput, modificado hace 9 años.
RE: import js file
Liferay Master Mensajes: 875 Fecha de incorporación: 7/01/11 Mensajes recientes
Check for any JS error . By using firebug extension in firefox you can also check loaded JS/CSS . See if your custom JS is getting loaded or not.
Filip Puškáš, modificado hace 9 años.
RE: import js file
Regular Member Mensajes: 238 Fecha de incorporación: 11/12/14 Mensajes recientes
If I put that code in main.js, it works ... I really have no idea whats wrong
Filip Puškáš, modificado hace 9 años.
solved
Regular Member Mensajes: 238 Fecha de incorporación: 11/12/14 Mensajes recientes
I put in portal_normal.ftl this link
and it works :-) ... thanks you all
<@liferay.js file_name="${themeDisplay.getPathThemeJavaScript()}/script.js" />
and it works :-) ... thanks you all