Hi all,
I have JS on one page on my site, rather than load it on every page via the template, how would I load it on one particular page?
Thanks
Lee
There is probably a better way, but I simply created a snippet that does that.
loadJs
<?php
$src = "assets/js/$param.js";
$modx->regClientStartupScript($src);
?>
Then I call it on the page like so:
[!loadJs? ¶m=`jQuery`!]
Jesse R.
Consider trying something new and extraordinary.
Illinois Wine
Have you considered donating to MODx lately?
Donate now. Every contribution helps.
Thanks for that, I’ll can keep my pages a little lighter in places now... thanks
Lee
-
MODX Staff
- 10,725 Posts
I often just create a template variable that has a default value of @INHERIT, and then simply add scripts (or whatever else) to it and put it at the bottom of my HEAD section in my templates.
Jason,
Is there any other little tips like that that you usually do to make like easier?
Chuck