Sitellite Application Framework
Class Tree         Index         All Elements

Procedural File: RPC.php

Source Location: Program_Root/Misc/RPC.php



Classes:



Page Details:

Sets up the necessary javascript includes and such for using the /js/rpc.js package. See that package for more info.

Usage:

echo rpc_init ('javascript to handle server response here...');










rpc_handle [line 142]

string rpc_handle( object reference &$obj, array $parameters)

Takes an object and the parameter list from a box call, executes

the specified method (a 'method' entry in the parameter list) with the rest of the values from the parameter list, and returns a serialized JavaScript variable, suitable for passing to the JavaScript eval() function.

This function operates independently of the others (ie. you do not need the calls to rpc_init() or rpc_response(). This function is used in conjunction with the new XMLHttpRequest-based RPC facilities in js/rpc.js.

Note: The following are reserved parameter names:

  • error
  • files
  • method
  • mode
  • page
  • param
Usage:

class Test { function hello ($name) { return 'hello ' . $name; } }

echo rpc_handle (new Test (), $parameters); exit;




Parameters

object reference   &$obj  
array   $parameters   hash
[ Top ]



rpc_init [line 15]

void rpc_init( [mixed $handler = 'return false'], [mixed $render = false])



[ Top ]



rpc_response [line 50]

string rpc_response( )

Creates a proper rpc server response out of the parameters passed to this function (uses func_get_args(), so pass it whatever you want).

Usage:

echo rpc_response (true); exit;




[ Top ]



rpc_serialize [line 73]

string rpc_serialize( mixed $val)

Serialize the specified PHP data into a JavaScript-compatible string.

Properly handles strings, numbers, boolean values, objects, and arrays, but does not maintain key associations in arrays.




[ Top ]



Copyright © 2007, SIMIAN systems Inc.
All rights reserved. Privacy policy
Documentation generated on Tue, 13 Feb 2007 17:18:56 -0600 by Sitellite AppDoc and phpDocumentor 1.2.2