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
Since CakePHP version 2.1 you can use script blocks:
// in your view
$this->Html->script('filename', array('block' => 'scriptBottom'));
// in your layout
echo $this->fetch('scriptBottom');
This approach lets you keep echo $this->fetch('script')
in the of your layout in case you need any scripts at the top.