Table of Contents
Application class calls functions described by event objects.
applications must be derived from application.class and contain an init (), close () and defaultview () function.
<? error_reporting (-1); $debug = 0; require 'proc/application.class'; # We must derive a new class from application. class MyApp extends application { # This is invoked once after the database connection in $this->db is # established and the token is validated if there is any. # You *MUST* register your views in here. function init () { $this->add_method ('my_view', $this); # This is a good place for dbi.class definitions or to allocate # other objects like a <link linkend="sect-ui">user interface</link>.. } function defaultview () { $v =& new view ('my_view', array ('text' => 'Hello World!')); echo '<A HREF="' . $this->link ($v) . '">Click here.</A>'; } function my_view () { echo '<h3>' . $this->arg ('text') . '</h3>'; } function close () { } } $app = new MyApp; $app->debug = $debug; $app->run (); ?>