diff options
author | Derek Allard <derek.allard@ellislab.com> | 2008-06-13 22:03:39 +0200 |
---|---|---|
committer | Derek Allard <derek.allard@ellislab.com> | 2008-06-13 22:03:39 +0200 |
commit | 1249107af8bad0434b310bda51d2de0a429a366c (patch) | |
tree | 3f621b3097723fa17ab8793e2f7a07d0b8d44bea /user_guide/libraries | |
parent | 61860c92fc3bf693537837448b584f2c8485ee46 (diff) |
Added "Using Associative Arrays In a Request Parameter" example to the XMLRPC userguide page.
Diffstat (limited to 'user_guide/libraries')
-rw-r--r-- | user_guide/libraries/xmlrpc.html | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/user_guide/libraries/xmlrpc.html b/user_guide/libraries/xmlrpc.html index e426f7008..e3d519037 100644 --- a/user_guide/libraries/xmlrpc.html +++ b/user_guide/libraries/xmlrpc.html @@ -398,9 +398,36 @@ class Xmlrpc_server extends Controller { <p>The client you created sends a message ("How's is going?") to the server, along with a request for the "Greetings" method.
The Server receives the request and maps it to the "process" function, where a response is sent back.</p>
+<h2>Using Associative Arrays In a Request Parameter</h2>
+
+<p>If you wish to use an associative array in your method parameters you will need to use a struct datatype:</p>
+
+<code>$request = array(<br />
+ array(<br />
+ // Param 0<br />
+ array(<br />
+ 'name'=>'John'<br />
+ ),<br />
+ 'struct'<br />
+ ),<br />
+ array(<br />
+ // Param 1<br />
+ array(<br />
+ 'size'=>'large',<br />
+ 'shape'=>'round'<br />
+ ),<br />
+ 'struct'<br />
+ )<br />
+ );<br />
+ $this->xmlrpc->request($request);</code>
+
+<p>You can retrieve the associative array when processing the request in the Server.</p>
+<code>$parameters = $request->output_parameters();<br />
+ $name = $parameters['0']['name'];<br />
+ $size = $parameters['1']['size'];<br />
+ $size = $parameters['1']['shape']; </code>
-<p> </p>
<h1>XML-RPC Function Reference</h1>
<h2>$this->xmlrpc->server()</h2>
|