why this code is not working?
Seemsm like i don't understand the usage of scriptstart()
and scriptEnd()
.
// view
<?php
$this->Html->scriptStart(array("block"=>true,"inline"=>FALSE));
?>
$().ready(function(){
alert("dd");
});
<?php
$this->Html->scriptEnd();
?>
// layout
echo $this->fetch('script');
edit
Some more info:
Try removing the "block"=>true option, or setting it to 'script' instead:
// view
<?php
$this->Html->scriptStart(array("block"=>'script',"inline"=>FALSE));
?>
$().ready(function(){
alert("dd");
});
<?php
$this->Html->scriptEnd();
?>
Make sure you include the php tags in the layout:
// layout
<?php echo $this->fetch('script');?>