General script structure
Prev | Chapter 20. moregroupware coding conventions | Next

## General script structure

Additions to the PEAR conventions:

      **********
      inclusion:
      **********

      global parameters:

      $myEnv[module] = "contact";
      $myEnv[output] = "html";

      include('MGW_vCard.php');

(export classes and functions that are to be reused in another context to a separate class of file).

      ********
      control:
      ********

      if (isset($dump)){
      dumpVCard($id, $PHPSESSID);
      } else {
      exportVCard($id, $PHPSESSID);
      }

(which will be more complex in other modules, but shows at the beginning of the page what functions to expect)

      ***************
      implementation:
      ***************

      function exportVCard($id, $PHPSESSID){
      ...}
      function dumpVCard($id, $PHPSESSID){
      ...}

Clearly defined interfaces what parameters we need to make the function work and to improve testing of single methods).

Prev | Up | Next
Using CVS | Home | Part V. Appendices