I have javascript code that uses velocity context and rundata objects, I have to have it to be included in a VM template. Is there a way for me to separate it into standalone file, say, screen-js.vm, and included in the GlobalMacros.vm file, like:
and screen-js.vm looks like:
$data.setLayoutTemplate("/NoNavigationJs.vm") ##this for not creating any header
<script type="text/javascript">
$(document).ready(function() {
//javascript code ...
}
</script>
But this doesn’t work, here is the page source, with 2 empty lines in the begining:
<script type="text/javascript">
$(document).ready(function() {
...
}
</script>
What I did wrong here? Thanks!
David
I figured it out:
#parse(“path/to/vm file”) will do.