In your view file app/View/Controller/view.ctp or at the top of your layout app/View/Layouts/layout.ctp put
$this->Html->script(
'jquery.min',
array(
'inline' => false,
'block' => 'script_bottom'
)
);
# or multiple scripts
$this->Html->script( array(
'jquery.min',
'slider'
),
array(
'inline' => false,
'block' => 'script_bottom'
)
)
In your layout file app/View/Layouts/default.ctp
</div>
<?php echo $this->element('sql_dump');
echo $this->fetch('script_bottom'); ?>
</body>
</html>
Outputs something like this:
<script type="text/javascript" src="/dev/cakephp-nodb/js/arbitrary_script_name.js"></script></body> </html>
The script or scripts needs to be copied into app/webroot/js
script_bottomĀ is a block name that you make up.

0 Comments