I create a snippet called myscripttest
:
<?php
$modx->regClientStartupScript('assets/templates/js/myscript.js');
put myscript.js into assets/templates/js
, call [myscripttest]
from my document. Result: it returns 404 for assets/templates/js/myscript.js
. Same after I clear cash.
But if I include default scripts via this snippet, everything works.
EDITED:
Nothing changes when I add a slash:
<?php
$modx->regClientStartupScript('/assets/templates/js/myscript.js');
Load the full url to the script in your browsers address bar. If it show up use your configs' assets path:
$modx->regClientStartupScript(MODX_ASSETS_PATH . 'templates/js/myscript.js');