AJAX
[ class tree: AJAX ] [ index: AJAX ] [ all elements ]

Source for file server.php

Documentation is available at server.php

  1. <?php
  2. /**
  3.  * Simplest possible usage of HTML_AJAX_Server
  4.  *
  5.  * The server responds to ajax calls and also serves the js client libraries, so they can be used directly from the PEAR data dir
  6.  * 304 not modified headers are used when server client libraries so they will be cached on the browser reducing overhead
  7.  *
  8.  * @category   HTML
  9.  * @package    AJAX
  10.  * @author     Joshua Eichorn <josh@bluga.net>
  11.  * @copyright  2005 Joshua Eichorn
  12.  * @license    http://www.opensource.org/licenses/lgpl-license.php  LGPL
  13.  * @version    Release: @package_version@
  14.  * @link       http://pear.php.net/package/HTML_AJAX
  15.  */
  16.  
  17.  // include the server class
  18. include 'HTML/AJAX/Server.php';
  19.  
  20. // include the test class will be registering
  21.     include 'support/test.class.php';
  22.  
  23. // create our new server
  24. $server = new HTML_AJAX_Server();
  25.  
  26. // register an instance of the class were registering
  27. $test =new test();
  28. $server->registerClass($test);
  29. $server->ajax->packJavaScript = true;
  30.  
  31. // handle different types of requests possiblities are
  32. // ?client=all - request for all javascript client files
  33. // ?stub=classname - request for proxy stub for given class, can be combined with client but this may hurt caching unless stub=all is used
  34. // ?c=classname&m=method - an ajax call, server handles serialization and handing things off to the proper method then returning the results
  35.  
  36. $server->handleRequest();
  37. ?>

Documentation generated on Sat, 05 May 2007 18:00:23 -0400 by phpDocumentor 1.3.0. PEAR Logo Copyright © PHP Group 2004.