[TYPO3-dev] FYI - ACE

Johannes Reichardt typo3 at gramba.de
Thu Sep 7 13:15:07 CEST 2006


Hi Elmar,

i had a quick look at xajax - maybe its best i show you how to use ACE 
so you see the difference.

1. have normal php class with simple returns (no registering or 
including of any ajax wrapper or parsing data in a specific way)
2. this class is only adjusted to have a "methodtable" (an array like 
realurl on top ;) which defines which types of data may be passed to the 
method - this is for security

thats the whole php part.
now you put a script src in your html like

script src="js/ACE.php?class=myClass" (assuming myClass.class.php is in 
the same folder as ACE.php)

after that everything else is done automatically - ACE has created a new 
object called "myClass" in js which holds all methods of your php class 
- another side
effect is the included JSL library which enables full JS 1.5 support for 
old browsers.

an interaction is done like this:

var myClassObj = new myClass();
myClassObj.myMethod.call(some data, can be an array or an object - 
doesnt matter,foo1,foo2);
myClassObj.myMethod.result = function (d) { alert(d) }

thats it.

So the great thing is that you don´t have to customize the class for it 
(except the method table for security) and you get full JS 1.5 support 
for older browsers just out of the box. also you get an Object 
containing all your class methods so you can make Ajax transactions even 
with one-liners. The dynamic JS creation keeps the js download to a 
mininum. Last but not least the native support of php serialize in JS - 
thats why you can move all types of data around like it was all PHP. Ah 
- and its very fast, supports gzip compression etc...

Xajax seems a bit more complex to handle - never worked with it though ;)

- Johannes




> Johannes Reichardt wrote:
>   
>> Hi there,
>>
>> sorry for throwing in unrelated stuff from time to time - just did heavy
>> research over the last weeks which was AJAX related and felt like the
>> whole web-world changed silently and i sat next to it without noticing
>> at all ;) (and i am not really a web-novice ;)
>>
>> So i attached ACE fyi (its a bit hard to get the file right now from the
>> developers site) which is a ajax/php gateway with *very* interesting
>> usage. Actually it allows native and transparent interaction of objects
>> and variables and dynamically creates a reference to all methods inside
>> a given class - a bit tricky but maybe worth a look for Typo3 5.0 or
>> so... - its the improved version of AJSHP i posted a while ago...
>>
>> - Johannes
>>
>> PS: zip contains a full demo and examples which just have to be uploaded
>> on php enabled webspace, developer site is www.devpro.it.
>>     
>
> Hi Johannes,
>
> could you give a comparism of ACE and xajax after investigations. From
> the short description of ACE I don't see the differences or innovation.
>
> Regards
>
> Elmar
>
>
>
> <quote>
> Detailed description:
>
> This package can be use to generate Javascript to call functions of PHP
> class objects from the client side.
>
> It generates Javascript code to create Javascript objects on the client
> side that act as proxies of PHP objects on the server side.
>
> The generated code uses AJAX to communicate with the server side script
> that defines the ACE class.
>
> The class can create the PHP object on the server side and call the
> functions that were invoked on the client side using the generated
> Javascript proxy class.
> </quote>
> _______________________________________________
> 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