[TYPO3-dev] Time for AJAX coordination?

Ries van Twisk typo3 at rvt.dds.nl
Fri Feb 10 20:56:30 CET 2006


tapio wrote:

>Zach Davis wrote:
>  
>
>>tapio wrote:
>>
>>    
>>
>>>I looked that it uses just one small file.
>>>In the scripts of Maximo there is six basic sripts +
>>>one specific for Typo3. That must be more versatile.
>>>
>>>Do somebody know JSON?
>>>      
>>>
>>More scripts = better?
>>    
>>
>
>at least offers flexibility
>
> >Last I checked xajax is made up of 3 php scripts
>  
>
>>and some javascript, not that I think that's particularly relevant to 
>>how useful of a tool it is.
>>    
>>
>
>yes - xajax is *must* be too limited - and that's why rejected. I found 
>only *one* script.
>
>Onno uses jpspan. It seems to have a proper library. Presumably JSON has 
>too a proper library.
>  
>
I am not sure about other libraries, but with jpspan you can call 
functions within classes directly which is a huge plus, jpspan also as a 
nice feature to return array's of data...

This will save you a lot of time making wrappers around classes. That 
means you can initliase typo3 complete and then
call a function directly. I do something like this.

First, everyclass that has ajax functions needs to register itself to.....
I do this like this:
$ret = $GLOBALS['TYPO3_GPMEMORY'] -> ajaxRegisterClass('classname', 
'EXT:ltg_reviews/p1/class.pluginname.php');
I do this so I don't have to load all extensions and can serve the call 
fast, that is also a reason I don't call any page within typo3 simply to 
speed up requests like sochat does...

Then in a file in the root of typo3 dir I do this:
1) Init typo3 and connect to database
2) Send some header data so the request doesn't get cached
3) Retreive needed class from uri (I use jpspan)  ($class = &$mem -> 
ajaxGetClass($_REQUEST['class']);)
4) Include php file to load class, this I receive from the register 
class thingy above.
5a) serve javascript if needed, this is created by jpspan!
5b) Call function in plugin and return some data.

When I do it like this I can register as many functions as I like and 
don't have to change my base php anymore, just register and done....

Something also I noticed:
1) I think we need to seperate the XML call, the ajax part from other 
functional librarys that can operate on the DOM tree.
The ajax library needs to be fast and simple and only does the XML 
request and get data back, jpspan does an execelent job for this
Also, with fast I mean from a users perspective, not how many us it takes.
if one class does a call in 200ms, but is fast and easy to use then I 
prefere that above a claa that does it in 100ms.
De FE user won't notice the difference anyways. Also you don't want to 
load your servcer with 10req/sec anyways.....

2) yes it's good to have librarys that can do DOM operations, but this 
has nothing to do with the XML call.
So we can look for a DOM library seperate from a Ajax class library set.



Ries







>I checked Maximos existing implemantations. Eight (not six as I 
>incorrectly wrote) basic JavaScript scripts + some controller php-scripts.
>
>The base library must be proper and give enough flexibility.
>_______________________________________________
>TYPO3-dev mailing list
>TYPO3-dev at lists.netfielders.de
>http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-dev
>  
>





More information about the TYPO3-dev mailing list