Fórumok

import js file

Filip Puškáš, módosítva 9 év-val korábban

import js file

Regular Member Bejegyzések: 238 Csatlakozás dátuma: 2014.12.11. Legújabb bejegyzések
How can I import a javascript file ?

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 :-)
thumbnail
Ravi Kumar Gupta, módosítva 9 év-val korábban

RE: import js file

Liferay Legend Bejegyzések: 1302 Csatlakozás dátuma: 2009.06.24. Legújabb bejegyzések
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.
Filip Puškáš, módosítva 9 év-val korábban

RE: import js file

Regular Member Bejegyzések: 238 Csatlakozás dátuma: 2014.12.11. Legújabb bejegyzések
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 :-(
thumbnail
Jitendra Rajput, módosítva 9 év-val korábban

RE: import js file

Liferay Master Bejegyzések: 875 Csatlakozás dátuma: 2011.01.07. Legújabb bejegyzések
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áš, módosítva 9 év-val korábban

RE: import js file

Regular Member Bejegyzések: 238 Csatlakozás dátuma: 2014.12.11. Legújabb bejegyzések
If I put that code in main.js, it works ... I really have no idea whats wrong
Filip Puškáš, módosítva 9 év-val korábban

solved

Regular Member Bejegyzések: 238 Csatlakozás dátuma: 2014.12.11. Legújabb bejegyzések
I put in portal_normal.ftl this link

	&lt;@liferay.js file_name="${themeDisplay.getPathThemeJavaScript()}/script.js" /&gt;


and it works :-) ... thanks you all