R: [ok] Re: [PEAR-DEV] HTML_AJAX, QuickForm_Livesearch and magic methods
| From: | Giuseppe Dessì | Date: | Mon, 26 Jun 2006 17:46:38 +0000 |
| Subject: | R: [ok] Re: [PEAR-DEV] HTML_AJAX, QuickForm_Livesearch and magic methods | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-43118@lists.php.net to get a copy of this message | ||
> -----Messaggio originale-----
> Da: Joshua Eichorn [mailto:josh@bluga.net]
> Inviato: lunedì 26 giugno 2006 18.51
> A: thesee@fastwebnet.it
> Cc: pear-dev@lists.php.net
> Oggetto: [ok] Re: [PEAR-DEV] HTML_AJAX, QuickForm_Livesearch
> and magic methods
>
> thesee@fastwebnet.it wrote:
> > Hi all.
> > I'm extensively testing and using HTML_QuickForm_Livesearch.
> > The integration with HTML_AJAX works good.
> > But in the normal use there is a limit.
> > I dont know if its a my fault...
> > I'm trying to set a large number of livesearch elements in a form.
> > It work great.
> > Every element has an id which is used as target.
> > Every id call a method of a class 'livesearch.class.php'
> (as you can
> > see on the example in HTML_AJAX or QF_Ls release)
> >
> > The problem is:
> > When I have a large number of elements, i must set for each
> element an
> > unique id.
> > for each id (target) there is a method on the php livesearch class.
> > So if i have 100 element and every element do the same search
> > search(methods) i must write down 100 equal methods.
> > so, I'm working with PHP5...well.....can I use magic
> methods? __call __get?
> > I tryed it but seem that the AJAX class ignore this magics methods.
> >
> >
> > Some tips?
> >
> > Thank you very much
> > Regards
> > Giuseppe Dessì
> >
> >
> For security purposes HTML_AJAX only allows calls to
> registered methods on a class. There is no introspection for
> magic methods, so they can't be autodetected and registered.
>
> You should be able to pass all the methods into the
> registerClass call though and have things work (I haven't
> tested that, but if it doesn't file a bug and will get it fixed) -josh
>
Ok, it works.
I found this workaround:
I passed all methods (even if they not exits). the important thing is they
are al passed(a simple foreach, an array..)
So, the methods is registered, but if the method really dont exists then the
magic method is called.
Thank you for support.
I'll put this example as a "hack example" ;)
Bye
Giuseppe