I am trying to insert JS files into the view but they are being inserted in the wrong order.
In my default.ctp I have this
$this->Html->script(array(
'https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js',
'global'
), array('inline'=>false));
echo $this->fetch('script');
In my view I have this:
$this->Html->script('jquery.fancybox.pack', array('inline' => false));
But when I view the source it comes out like this:
<script type="text/javascript" src="/js/jquery.fancybox.pack.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="/js/global.js">
Which is obviously the wrong order so the jQuery plugin is not working.
What am I doing wrong?