A Cabron Service can be a procedural PHP source file, or a PHP object.
If you choose the procedural approach, you should create a simple php file, name it as you like, and define at least one function in it.
The function should return a value: this will be transferred by the gateway to the Flash movie. The returned value can be primitive data, any kind of array, null, or CabronRecordset object.
If you choose the object-oriented approach, you should create a php source file, with a class inside that is named as the php file with the first letter capitalized. After this, you should define at least one method of the object. The returned value of the method can be primitive data, any kind of array, null, or CabronRecordset object.
The services should be placed below the directory that is specified in the gateway/gateway.php
You can create subfolders in this folder, and put the services there. In this case in the Flash movie you should specify the path to the service using the dot syntax. If you have a service in services/siteNameServices/service1.php
, you will create the service instance in ActionScript like this:
var service = cc.getService("siteNameService.service1",this);
All the services are included in the gateway.php
, so the working directory of the service is the one where the gateway is located.
If you want to include files into the services, you should do this using the $CabronServiceFolder
global variable, which specifies the service folder.