Wrapping Things Up and Laying Out the Structure
In this final section of the chapter, we are establishing the scheme of a basic code structure, which we will use in all the following case studies. Most of the basic building blocks have already been presented, except for separating the sever-side business logic in a separate class, which will be demonstrated in a new exercise.
So far, the server-side code was always built as a single PHP file. In order to achieve better flexibility and a more powerful design, we will split the server-side PHP functionality in two files:
One script, called
appname.php
(whereappname
is the name of your application) will be the main access point for the client-side JavaScript code. It will deal with the input parameters received throughPOST
andGET
, and will make decisions based on these parameters.The second script, called
appname.class.php
, will contain a helper class namedAppname
, which encapsulates the real functionality that needs to be processed. The...