title: Cakephp, send text javascript to bottom of layout from view
body: <p>I want to send a script from view to the bottom of the layout in order to get the script executed in last.</p>
  
  <p>At the moment, I'm using this in my layout :</p>
  
  <pre><code>echo $this-&gt;fetch('scriptBottom');
  </code></pre>
  
  <p>And</p>
  
  <pre><code>$this-&gt;Html-&gt;script('myjs', array('block' =&gt; 'scriptBottom'));
  </code></pre>
  
  <p>in my view, at the very bottom of the body.</p>
  
  <p>But in my view</p>
  
  <pre><code>$this-&gt;Html-&gt;script('alert(\'lol\''), array('block' =&gt; 'scriptBottom'));
  </code></pre>
  
  <p>Doesn't work.</p>
  
  <p>As I need to generate js code from php, how can I do?</p>
  
  <p>PS I already checked this and it didn't help : <a href="http://api.cakephp.org/2.4/class-HtmlHelper.html#_script" rel="nofollow">http://api.cakephp.org/2.4/class-HtmlHelper.html#_script</a></p>