XOAD (a PHP based AJAX/XAP object oriented framework) tutorial

Home arrow AJAX Tutorials arrow Tutorial arrow XOAD (a PHP based AJAX/XAP object oriented framework) tutorial
XOAD (a PHP based AJAX/XAP object oriented framework) tutorial Print E-mail
Contributed by Joe   
Friday, 15 September 2006

What  is XOAD (PHP and Ajax)?

XOAD,an acronym for XMLHTTP Object-oriented Application Development., is a server-side Ajax toolkit written in PHP.

 

XOAD Features:

  • it uses JSON and native PHP serialized objects to communicate,
  • special attention has been paid to security,
  • supports server side events ,
  • client side events ,
  • server and client extensions,
  • HTML manipulation ,
  • Caching .

 Downloading and Installing XOAD

Latest Version  is  0.6.0.0, you can download from here

Create a sample XOAD application

The aim of this example is to calculate the length of a string and dispaly it 

Create a myClass.class.php

<?php
class myClass {
  function stLength($mystring) {
      return strlen($mystring);
    }
  function xoadGetMeta() {
      XOAD_Client::mapMethods($this, array('stLength'));
      XOAD_Client::publicMethods($this, array('stLength'));
    }
}
?>

 Note: stLength()  merely returns the length of a string variable

 Below shows the XOAD application

<?php
require_once('myClass.class.php');
require_once('xoad.php');
XOAD_Server::allowClasses('myClass');
if (XOAD_Server::runServer()) {
  exit;
  }
?>
<?= XOAD_Utilities::header('.') ?>
<script type="text/javascript">
var myobj = <?= XOAD_Client::register(new myClass()) ?>;
var mystring = 'Hello World! (XOAD Application)';
myobj.onStLengthError = function(error) {
  alert(error.message);
  return true;
  }
myobj.stLength(mystring, function(result) {
  document.write('String: ' + mystring + '<br />Length: ' + result);
  });
</script>

Conclusion:

it demonstrates the concept of methods from server-side PHP classes being made available on the client side as JavaScript objects.

Reference:

SAMS Teach Yourself Ajax in 10 Minutes

Related Tutorials
Last Updated ( Friday, 15 September 2006 )

  home              contact us

 

©2006-2008 DeveloperZone.biz   All rights reserved     powered by Mambo Designed by Siteground