Developer's Guide : Frontend
Frontend Guide: Pages
Integrating the CPAINT Frontend and Creating the Object
Once your design is complete, the next step is to include the CPAINT frontend classes. This can be achieved by putting the following line of code in the head section of the HTML document. (Of course, you might need to point to a different file location.)
Please note that since CPAINT v2.0 a compressed version of the frontend exists. Its functionality is in every way identical to that of the standard version but all comments and unnecessary whitespace have been removed, reducing it to approx. 50% the size. So if traffic is a concern to you - or you're just being kind - you should use cpaint2.inc.compressed.js instead.
Second, you will need to create an instance of the cpaint object. (Note: This cpaint object is different from the backend class of the same name.) Again, in the head section of your HTML document, add the following lines to create an instance named cp.
var cp = new cpaint();
You can also set any configuration options, such as debugging, transfer mode, synchronicity, response type, and connection persistence. (We will get into turning off the CPAINT backend API and proxy connections later.)
By default, here are the CPAINT option defaults:
- transfer mode = GET
- asynchronous = true
- response type = OBJECT
- persistent connection = false
- debugging = level 0 (none)