I’ve been trying to figure out how to do this for a while and am stumped. For some crazy reason, YII goes against best practices and tries to insert all this JS in the HEAD tags and throughout the body. I want all of the JS to appear right before the closing body tag.
I’m using my own jQuery (v.1.9.0), Bootstrap, etc. and have set the scriptMap settings to false. However, yiiactiveform is still being inserted in the HEAD tags and JS that is used in my views using enableClientValidation and also JS written at the bottom of my views is still showing up in the BODY.
Its not so much that it goes against best practices as the BEGIN position is the default. You can change it quite easily.
CClientScript is your friend. With CClientScript you can add your javascript code or source files anywhere you like. If you want them to be on every page I suggest that you add them where you want them in your master layout file (most likely called main.php in you layout directory). Here is a quick usage example to put in you view:
So, in the example you have the script name as the first argument, the script code as the second argument, and finally the script position as the third argument. Your choices for position are: