You can load scripts from within your views, too.  I'm playing with
ajax, jquery, and ext.js, and I had similar problems.  Put something
like this at the bottom of your view:

<?php echo $javascript->link('myScript.js'); ?>

NOTE - you have to but this at the bottom of the view.  I tried
putting it at the top, but the scripts never ran in IE.  They worked
in FireFox, though.  Go figure . . .

I hope that helps.

hydra12

On May 25, 2:27 pm, "Pablo Viojo" <[EMAIL PROTECTED]> wrote:
> I use to load javascript files on the fly using a **synchronous** connection
> (using XMLHttpRequest)
>
> sUrl="http://example.com/scriptftoload.js";;
>
>     if (window.XMLHttpRequest) {
>       xmlhttp = new XMLHttpRequest();
>       if ( typeof xmlhttp.overrideMimeType != 'undefined') {
>         xmlhttp.overrideMimeType('text/xml');
>       }
>     } else if (window.ActiveXObject) {
>       xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
>     } else {
>       alert('Perhaps your browser does not support xmlhttprequests?');
>     }
>
>     xmlhttp.open('GET', sUrl, false);
>     xmlhttp.send(null);
>
>     eval (xmlhttp.responseText);
>
>     //some call to the loaded code
>
> Also, you can create a new <script> node an append it to the head section
>
>         sUrl="http://example.com/scriptftoload.js";;
>         var script = document.createElement("script");
>         script.src=sUrl;
>         script.type="text/javascript";
>         script.charset="utf-8"
>         document.childNodes
> [0].getElementsByTagName("head")[0].appendChild(script);
>
> Beware of the fact that this request is made asynchronously, so you can't
> expect to use the code loaded inmediately
>
> --
> Pablo Viojo
> [EMAIL PROTECTED]://pviojo.net
>
> On 5/25/07, John - PostalService <[EMAIL PROTECTED]> wrote:
>
>
>
> > The Head helper is non existant.  Do you have a custom helper that you
> > are using?
>
> > Thanks,
>
> > John
>
> > On May 12, 11:08 am, stacey <[EMAIL PROTECTED]> wrote:
> > > You can call like this from the view:
>
> > > <?php echo $head->js('customborders/cb'); ?>
>
> > > and you need to include the 'head' helper in your controller:
>
> > > var $helpers = array('Html', 'Head'); // html is always needed
>
> > > On May 12, 12:53 pm, dom <[EMAIL PROTECTED]> wrote:
>
> > > > Hi everybody.
> > > > I wonder if it is possible to load a javascript file outside the
> > > > <head> section of the layout. I have only one layout, default.thtml,
> > > > as all the calls are Ajax calls. So I have only one <head> section...
> > > > But I don't want to load the whole of my javascript file at once. It
> > > > would be more sensible to cut it up into smaller files and load only
> > > > the minimum at first and load the rest later as needed.
> > > > Does that make any sense ? And if it does, how can you do it?
>
> > > > Dom


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to