[TYPO3-dev] Time for AJAX coordination?

Dmitry Dulepov typo3 at fm-world.ru
Fri Feb 10 22:44:47 CET 2006


Hi!

Michael Scharkow wrote:
> I just had a look into XAJAX and I am really sceptical if it fits us.
> The assignment and registration functions don't look particularly
> elegant to me, and the replacements (and lots of other stuff) are
> defined in the called function and not in the caller.

I use it in one private application and it does very well. It was very
easy to use: create handlers, specify responses, etc.

> Just imagine you have a function called comment_form() that you want to
> call with AJAX. With xajax you have to know in advance which div you
> want to fill with the form because you do
> 
> $objResponse->addAppend("myDiv1","innerHTML",$DataFromDatabase2);
> return $objResponse;

You can construct DIV name on the fly :) In fact I use Smarty in my app
and names of DIVs are generated dynamically.

> Moreover, you can't use the same controller method for both
> normal HTML and AJAX output which is also a must IMHO.

I am not sure that I understand what you mean... I do not really care
about ancient browser that do not implement xhttprequest object. I think
they either already dead or dying. Even Opera < 7.60 does not appear too
often now.

In any case, I found a nice ajax emulator on the internet. If browser
does not support xhhtprequest, it is emulated with iframe.

> In Rails you write this in your view:
> <%= link_to_remote( "comment this article",
>                          :update => "mydiv1",
>                          :url =>{ :action => :comment_form }) %>
> 
> So you can set the div in the caller and reuse the comment_form method
> everywhere in your app.

I am not familiar with Rails :(

> Moreover, XAJAX does *only* do AJAX stuff, whereas for example
> prototype.js has lots of other neat JS features like observers (for
> forms etc.) and powerful selector functions.

Well, we are talking about ajax library, not about generic JS library.
We are not going to bring scripaculos to typo3 just because it is fun,
are we? :)

> I'm not saying that prototype (and behaviour.js for complete
> unobstrusiveness) is definitely better, but we should carefully look at
> the relevant options before making a decision.

Sure. I looked into a number of ajax frameworks and xajax suited my
purposes best. I believe there can be cases when other framework serves
better.

> Of course, we would need to provide our own PHP wrappers, but we have
> t3lib_ajax already, and we could concentrate on making the wrapper
> functions perfect for TYPO3 and not worry about the JS and AJAX basics.

This is what I though about. Details of actual ajax implementation
should be hidden behind typo3 wrapper. This way people do not have to
change their implementation if we decide to change underlying framework.

Dmitry.
---
"It is our choices, that show what we truly are,
far more than our abilities." (A.P.W.B.D.)




More information about the TYPO3-dev mailing list