Tuesday, March 29, 2011

JS at bottom of page

I am just trying out the new JS helper and going thru the book I simply
added this into the middle of a random page to test it out

<?php $this->Html->scriptStart(array('inline' => false, 'cache' => true));
echo $this->Js->alert('I am in the javascript');
$this->Html->scriptEnd();?>

In the layout added

<?php $this->Js->writeBuffer();?>
<?php //echo $this->Js->writeBuffer();?>
</body>
</html>

Sure enough I get the alert

But I end up with the code at the top of my page after the rest of the other
scripts. I thought it would output the scriptStart / End at the bottom?
<script type="text/javascript" cache="1">
//<![CDATA[
alert("I am in the javascript");
//]]>
</script>

Even if I completely remove $this->Js->writeBuffer(); it still gets added to
the top. I clearly am not understanding the point of this.

Any help would be great.

Thanks,

K

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: