Difference between revisions of "GMOD RPC API/PHP"

From GMOD
Jump to: navigation, search
(rpc.php)
Line 20: Line 20:
 
==== rpc.php ====
 
==== rpc.php ====
 
All this does is parse the URL to instantiate a contoller object for the desired service and a view object.  The class files live in
 
All this does is parse the URL to instantiate a contoller object for the desired service and a view object.  The class files live in
  gmod-rpc/v1/sources/class.Source.php/  
+
  gmod-rpc/v1/sources/class.SourceName.php/
  gmod-rpc/v1/services/class.ServiceName.php  
+
  gmod-rpc/v1/services/class.ServiceName.php
 
  gmod-rpc/v1/class.View.php
 
  gmod-rpc/v1/class.View.php

Revision as of 22:41, 15 January 2010

Plans/Architecture for the PHP tools for implementing gmod-rpc

Components

index.php

gmod-rpc/index.php

Use mod_rewrite so that gmod-rpc URLs all go to this script

<IfModule mod_rewrite.c>   
RewriteEngine on  
RewriteRule ^/gmod-rpc/.*$ /gmod-rpc/index.php  
</IfModule>

index.php looks for a version directory based on the URL.

class.myDomDocument.php

Very small class from Joe Grissom at Oklahoma for making XML. There is probably something more sophisticated that could be used in the future, but this works.

version directories

put everything else in a directory based on the version, e.g. v1

rpc.php

All this does is parse the URL to instantiate a contoller object for the desired service and a view object. The class files live in

gmod-rpc/v1/sources/class.SourceName.php/
gmod-rpc/v1/services/class.ServiceName.php
gmod-rpc/v1/class.View.php