Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
143
rated 0 times [  144] [ 1]  / answers: 1 / hits: 21006  / 10 Years ago, wed, october 22, 2014, 12:00:00

The cakephp docs say:




By default, script tags are added to the document inline. If you override this by setting $options['inline'] to false, the script tags will instead be added to the script block which you can print elsewhere in the document.




So in my view file (.ctp) I have:



echo $this->Html->script('//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js', array('inline' => 'false'));



And in my layout, in the head tag:



echo $this->fetch('script');



But the script tag prints out inline and not in the head. If I miss of the echo from the line in my view file, the script doesn't print out at all in my html.



Any help would be gratefully received.



PAE


More From » php

 Answers
14

You have false in quotes, so PHP is treating it as a string and not a boolean. It should be:



echo $this->Html->script('//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js', array('inline' => false));

[#69042] Monday, October 20, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
harleyterryp

Total Points: 290
Total Questions: 92
Total Answers: 95

Location: Montenegro
Member since Sun, May 7, 2023
1 Year ago
;