Welcome Guest, Not a member yet? Register   Sign In
Where do I put my javascript code?
#3

For JS management, we use the controller to setup an array of JS files (specific for the page) and then the PHP code in the view to load up the JS. We use two arrays, one for the top of the HTML (head_js_load) and one for the bottom of the HTML (footer_js_load) to keep all of the JS on the bottom of the page if we can.

We also configure the asset folders in the config.php file (config folder) so we're not typing in assets/js (or assets/css, etc - all files have standard locations). We do have an override function when prepping the array just in case a particular JS or CSS needs to be loaded from a different location.
Reply


Messages In This Thread
RE: Where do I put my javascript code? - by Kaosweaver - 01-03-2017, 07:00 AM



Theme © iAndrew 2016 - Forum software by © MyBB