PhpRiot

Listing 1808

Submitted by me, 30 November 2008
<?php
    define('ZFW_VERSION', '1.6.1');
    define('ZFW_PREFIX', '/usr/share/php/ZendFramework');
    define('APP_PATH', realpath(dirname( __FILE__ )));
 
    $paths = array(
        APP_PATH,
        APP_PATH.DIRECTORY_SEPARATOR,'application'.DIRECORY_SEPARATOR.'models',
        ZFW_PREFIX.DIRECTORY_SEPARATOR.'ZendFramework-'.ZFW_VERSION.DIRECTORY_SEPARATOR.'library',
        get_include_path()
        );
 
    /*** set the include paths ***/
    set_include_path(implode(DIRECTORY_SEPARATOR, $paths));
 
    /*** load up the framework ***/
    require_once('Zend/Loader.php');
 
    /*** register the autoload ***/
    Zend_Loader::registerAutoload();
 
    /*** load up the config ***/
    // $configuration = new Zend_Config_Ini( APP_PATH . '/config/fes.ini', APPLICATION_ENVIRONMENT );
    // $registry->configuration = $configuration;
 
    /*** load up pear db ***/
    $dbh = DB::connect("pgsql://bruce:snurgs@localhost/my_db");
    Zend_Registry::set('db', $db);
 
    /*** configure the front controller ***/
    $front = Zend_Controller_Front::getInstance();
 
    /* always use the default controller 
     * this is handy if you want to have a redirect when and exception is thrown
     */
    // $front->setParam('useDefaultControllerAlways', true);
 
    /*** enable exceptions, should be turned off for production ***/
    $front->throwExceptions(true);
/*
    $front->setControllerDirectory(array(
            'default' => APP_PATH.DIRECTORY_SEPARATOR.'application/controllers',
            'ttp'    => APP_PATH.DIRECTORY_SEPARATOR.'application/ttp/controllers'
            ));
*/
    $front->addModuleDirectory(APP_PATH.DIRECTORY_SEPARATOR.'application/modules');
 
    /*** load up the controller ***/
    $front->run(APP_PATH.DIRECTORY_SEPARATOR . 'application/controllers');
Submit a Follow Up