Example #1
0
$root = realpath('.');
$lib_root = $root . '/lib';
$app_root = $root . '/app';
// Include all base classes explicitly, autoload the rest
include $lib_root . '/application.php';
include $lib_root . '/db.php';
include $lib_root . '/db_result.php';
include $lib_root . '/input.php';
include $lib_root . '/session.php';
include $lib_root . '/validation.php';
include $lib_root . '/model.php';
include $lib_root . '/controller.php';
include $lib_root . '/view.php';
// Initialize the application
Application::initialize();
Model::$root = $app_root . '/models';
Controller::$root = $app_root . '/controllers';
View::$root = $app_root . '/views';
// Database connectivity
DB::$adapter = "mysql";
DB::$host = "";
DB::$user = "";
DB::$password = "";
DB::$database = "";
DB::$adapter_root = $lib_root . '/db';
// Load the database adapter, will die() if not found
DB::load_adapter();
function __autoload($class)
{
    if (!Application::load($class)) {
        die("Could not locate class: {$class}");