Documentation Index

CPAINT :: Cross-Platform Asynchronous INterface Toolkit

Developer's Guide : Backend

Backend Guide: Pages

integrating CPAINT
implementation differences
generating XML
complex return-data
arbitrary character encodings

Generating the XML

As mentioned above, we use XML by default to return data from the backend. Since we're only returning a single value, we can use the cpaint.set_data() method on the top level to set the data. Use this method in place of function return statements.

PHP Example

  require_once("cpaint v2/");

  $cp = new cpaint():

  function calculate_tax($sales_amount) {
    global $cp;
    $cp->set_data($sales_amount * 0.075);

For simple returns, we're now done. The XML that will be returned from the backend will look like (assuming the input value was 1):