how to include js file in php?
I found a different solution that I like:
<script>
<?php require_once("/path/to/file.js");?>
</script>
Also works with style-tags and .css-files in the same way.
PHP is completely irrelevant for what you are doing. The generated HTML is what counts.
In your case, you are missing the src
attribute. Use
<script type="text/javascript" src="file.js"></script>