Initialisation

application.class automatically connects to the database using login data from a configuration file in its working directory and calls the init() function which should occur in the derived class where user-defined stuff can be initialised, The member variables 'dbi' and 'session' point to the database and a session class used by application.class.

application () constructor

There is no constructor for application objects. All initialisation is done in run ().

<?
  require 'proc/application.class';
  class MyApp extends application {
    # ... more code ...
  }

  $app = new MyApp;
  $app->run ();
?>
        

run ()

Run an application object.

<?
  $app = new MyApp;
  $app->run();
?>
        

.dbi.conf.php file

application.class expects a configuration file named '.dbi.conf.php' in its working directory.


<?
  # Example config file.
  $dbidatabase = 'mydatabase';
  $dbiserver = 'localhost';
  $dbiuser = 'myuser';
  $dbipwd = 'secret_password'; # Mix numbers, letters and special chars!
?>

        

Some library parts need additional information in the .dbi.conf.php file, e.g. the language type or table names.

init() in derived class

If application class initialised itself in the run () function and connected to a database, it calls the init function of the derived class where tables must be defined and the page functions must be registered.

Member variable debug - debug mode

If the member variable 'debug' is true, the functions calls are traces and dumped as preformatted print_r () dump.

<?
  $app = new MyApp;
  $app->debug = true;
  $app->run();
?>
        

Member array raw_views - Mark views as raw.

This array contains the views as keys which output HTML on their own. The the user interface takes care of it and doesn't output HTML headers for views marked raw.