Currently, I have a big CakePHP application with a layout and a lot of views. In the layout, I load Javascript files in the head which are needed by most views. In the views the
This is what I do in my view:
echo $this->Html->script('filename', array('inline' => false));
And this is what I do at the bottom of my layout:
echo $this->fetch('script');