I wanna load javascript files within an extension and load the javasript before calling a function
variant 1 via includejs
Code: Select all
<!-- INCLUDEJS @mod_mod/myfileinclude.js?assets_version={T_ASSETS_VERSION} -->
Code: Select all
<script type="text/javascript" src="mylink/myfilescript.js"></script>
<script>
var input = document.getElementById('str');
var colorHash = new functionA();
...
</script>
variant 1:
+ file is within ext mod_mod
- file is (nearyly) included on the bottom of the outputfile. So it is after functionA and produces error message ReferenceError: functionA is not defined (i guess it is because the javascript isnt loaded before)
variant2
+ is included before the call of the function
+ It works
- i cant use @mod_mod
how can i use INCLUDEJS so that it is loaded before the call of the function?