PHP interesse |
|
hm, nee hetgeen blijkt niet te werken.
hier een screenshot van mijn structuur (developemt is een subdomein):
http://www.robmoorman.nl/files/1.png
mijn bootstrap:
<?php
/**
* @author Rob Moorman
* @copyright Rob Moorman
* @version 1.0, 05-01-2009 23:50
*/
class Application
{
private $_config;
private $_db;
private $_front;
private $_view;
private $_auth;
private $_acl;
/**
* Initialize the application.
*/
public function init()
{
require_once( 'Zend/Loader.php' );
Zend_Loader::registerAutoload();
Zend_Session::start();
$this->setConfig();
$this->setDatabase();
$this->setController();
$this->setLayout();
$this->setAuth();
$this->setAcl();
$this->setPlugins();
$this->setRegistry();
$this->run();
}
/**
* Load the configuration file.
*/
private function setConfig()
{
$this->_config = new Zend_Config_Ini( '../application/config.ini' );
}
/**
* Setup the database.
*/
private function setDatabase()
{
$this->_db = Zend_Db::factory( 'Pdo_Mysql', $this->_config->Production->db );
Zend_Db_Table::setDefaultAdapter( $this->_db );
}
/**
* Setup the Zend Framework front controller.
*/
private function setController()
{
$this->_front = Zend_Controller_Front::getInstance();
$this->_front->setControllerDirectory( array(
'default' => '../application/controllers',
'admin' => '../application/admin/controllers'
) );
$this->_front->throwExceptions( false );
$this->_front->setParam( 'auth', $this->_auth );
$this->_front->setParam( 'acl', $this->_acl );
}
/**
* Set the layout.
*/
private function setLayout()
{
Zend_Layout::startMvc( array(
'layoutPath' => '../application/views/layouts'
) );
$this->_view = Zend_Layout::getMvcInstance()->getView();
$this->_view->doctype( 'XHTML1_TRANSITIONAL' );
$this->_view->addHelperPath( '../application/views/helpers' );
}
/**
* Setup the authentication.
*/
private function setAuth()
{
$this->_auth = Zend_Auth::getInstance();
}
/**
* Setup the Access Control List.
*/
private function setAcl()
{
$this->_acl = new Application_Acl( $this->_auth );
}
/**
* Apply plugins to the Front Controller.
*/
private function setPlugins()
{
$this->_front->registerPlugin( new Plugins_Acl( $this->_auth, $this->_acl ) );
$this->_front->registerPlugin( new Plugins_Layout( $this->_view ) );
}
/**
* Setup the registry.
*/
private function setRegistry()
{
Zend_Registry::set( 'config', $this->_config );
Zend_Registry::set( 'db', $this->_db );
Zend_Registry::set( 'view', $this->_view );
Zend_Registry::set( 'auth', $this->_auth );
Zend_Registry::set( 'acl', $this->_acl );
}
/**
* Run the application.
*/
private function run()
{
$this->_front->dispatch();
}
}
?>
<?php /** * @author Rob Moorman * @copyright Rob Moorman * @version 1.0, 05-01-2009 23:50 */ class Application { private $_config; private $_db; private $_front; private $_view; private $_auth; private $_acl; /** * Initialize the application. */ public function init() { require_once( 'Zend/Loader.php' ); Zend_Loader::registerAutoload(); Zend_Session::start(); $this->setConfig(); $this->setDatabase(); $this->setController(); $this->setLayout(); $this->setAuth(); $this->setAcl(); $this->setPlugins(); $this->setRegistry(); $this->run(); } /** * Load the configuration file. */ private function setConfig() { $this->_config = new Zend_Config_Ini( '../application/config.ini' ); } /** * Setup the database. */ private function setDatabase() { $this->_db = Zend_Db::factory( 'Pdo_Mysql', $this->_config->Production->db ); Zend_Db_Table::setDefaultAdapter( $this->_db ); } /** * Setup the Zend Framework front controller. */ private function setController() { $this->_front = Zend_Controller_Front::getInstance(); $this->_front ->setControllerDirectory( array( 'default' => '../application/controllers', 'admin' => '../application/admin/controllers' ) ); $this->_front->throwExceptions( false ); $this->_front->setParam( 'auth', $this->_auth ); $this->_front->setParam( 'acl', $this->_acl ); } /** * Set the layout. */ private function setLayout() { Zend_Layout ::startMvc( array( 'layoutPath' => '../application/views/layouts' ) ); $this->_view = Zend_Layout::getMvcInstance()->getView(); $this->_view->doctype( 'XHTML1_TRANSITIONAL' ); $this->_view->addHelperPath( '../application/views/helpers' ); } /** * Setup the authentication. */ private function setAuth() { $this->_auth = Zend_Auth::getInstance(); } /** * Setup the Access Control List. */ private function setAcl() { $this->_acl = new Application_Acl( $this->_auth ); } /** * Apply plugins to the Front Controller. */ private function setPlugins() { $this->_front->registerPlugin( new Plugins_Acl( $this->_auth, $this->_acl ) ); $this->_front->registerPlugin( new Plugins_Layout( $this->_view ) ); } /** * Setup the registry. */ private function setRegistry() { Zend_Registry::set( 'config', $this->_config ); Zend_Registry::set( 'db', $this->_db ); Zend_Registry::set( 'view', $this->_view ); Zend_Registry::set( 'auth', $this->_auth ); Zend_Registry::set( 'acl', $this->_acl ); } /** * Run the application. */ private function run() { $this->_front->dispatch(); } } ?>
|