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.
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 (); ?>
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.
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.
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(); ?>
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.