Cakephp,从视图发送文本javascript到布局的底部

I want to send a script from view to the bottom of the layout in order to get the script executed in last.

At the moment, I'm using this in my layout :

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

And

$this->Html->script('myjs', array('block' => 'scriptBottom'));

in my view, at the very bottom of the body.

But in my view

$this->Html->script('alert(\'lol\''), array('block' => 'scriptBottom'));

Doesn't work.

As I need to generate js code from php, how can I do?

PS I already checked this and it didn't help : http://api.cakephp.org/2.4/class-HtmlHelper.html#_script

Shouldn't you use

$this->Html->scriptBlock('alert("lol")', array('block' => 'scriptBottom'));

?