well what I did was set up like this in the layout default.thtml
<?php
if(isset($javascript)){ echo $javascript->link('prototype'); }
?>
<?php
if(isset($javascript)){ echo
$javascript->link('scriptaculous.js?load=effects'); }
?>
<?php
if(isset($javascript)){ echo $javascript->link('controls'); }
?>

Now I think with this it loads them dinamicly only if I have setup the
helper on my controller.
But it still does return any data when I type something in the
$ajax->autocomplete view.


On 6/1/06, John David Anderson (_psychic_) <[EMAIL PROTECTED]> wrote:
>
> Just do something like this in your layout:
>
> <script src="/js/prototype.js" type="text/javascript"></script>
> <script src="/js/scriptaculous.js" type="text/javascript"></script>
>
> If that doesn't seem to help, you'll need to try to see if any JS
> errors are being generated. Firefox as a pretty nice JS console you
> can use to see the errors. If you're getting some, provide them here.
>
> -- John
>
>
> On Jun 1, 2006, at 10:53 AM, Carlos Mauricio Samour wrote:
>
> >
> > No this is what I am doing.
> > First I create the autocomplete function inside my controller.
> > < -- file app/controllers/productos_controller.php ->
> > <?php
> > class ProductosController extends AppController
> > {
> >       var $name = 'Productos'; // required for PHP4 installs
> >       var $helpers = array('Html', 'Javascript', 'Ajax');
> >       var $scaffold;
> >
> >       function autocomplete ()
> >       {
> >     $this->set('productos',
> >         $this->Producto->findAll(
> >             "descripcion LIKE '{this->data['Producto']
> > ['descripcion']}'")
> >         );
> >     $this->layout = "ajax";
> >       }
> >
> > }
> > ?>
> >
> > 2- I created a view for this function in :
> > <--  apps/views/productos/autocomplete.thtml-->
> >
> > <ul>
> >       <?php foreach($productos as $producto): ?>
> >       <li>
> >               <?php echo $producto['Producto']['descripcion']; ?>
> >       </li>
> >       <?php endforeach; ?>
> > </ul>
> >
> > 3 - I created another view that uses the ajax autocomplete helper in
> > <--  apps/views/productos/autocomplete.thtml-->
> >
> > <? echo $javascript->link('prototype') ?>
> > <? echo $javascript->link('scriptaculous.js?load=effects') ?>
> >  <? echo $javascript->link('controls') ?>
> > <form action="/users/index" method="POST">
> > <?php echo
> >       $ajax->autoComplete('Producto/descripcion', '/productos/
> > autocomplete')?>
> > <?php echo $html->submit('View Post')?>
> > </form>
> >
> > Ok one note about this view. I have to setup the $javascript libraries
> > here because if I try to setup those in my
> > apps/view/layout/default.thtml it gives me this error anywere in the
> > site.
> > Notice: Undefined variable: javascript in
> > /home/msamour/web/framework/concentrador/cake/app/views/layouts/
> > default.thtml
> > on line 20
> >
> > Fatal error: Call to a member function link() on a non-object in
> > /home/msamour/web/framework/concentrador/cake/app/views/layouts/
> > default.thtml
> > on line 20
> >
> > Can this be my problem? I am not using the layouts proprerly?.
> > Thanks for the help
> >
> > >
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to