05-07-2009, 04:03 AM
|
#3 (permalink)
|
|
The Prestige
Join Date: Dec 2007
Posts: 1,044
Thanks: 193
|
Quote:
Originally Posted by Village Idiot
Can you post the code?
|
Index.php
Code:
<?php
define("THIS_PAGE", "index");
define('BASE_PATH', realpath(dirname(__FILE__) . '../'));
define('APPLICATION_PATH', BASE_PATH . '/application');
set_include_path(BASE_PATH . '/library/incubator'
. PATH_SEPARATOR .BASE_PATH . '/library'
. PATH_SEPARATOR . get_include_path()
);
// APPLICATION_ENVIROMENT defines which config section is loaded
if(!defined('APPLICATION_ENVIRONMENT')) {
define('APPLICATION_ENVIRONMENT', 'production');
}
require_once 'Zend/Application.php';
$application = new Zend_Application(APPLICATION_ENVIRONMENT,
array(
'bootstrap'=>array('path'=>APPLICATION_PATH.'/Bootstrap.php'),
'autoloadernamespaces' => array('Zend', 'App')
));
$application->bootstrap();
$application->run();
?>
application/controllers/IndexController.php
Code:
<?php
class IndexController extends Zend_Controller_Action
{
public function init()
{
echo "This will output though.";
}
public function indexAction()
{
echo "This won't output.";
}
}
application/Bootstrap.php
Code:
<?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
protected $_config;
public function _initConfig()
{
// config
$this->_config = new Zend_Config_Ini(APPLICATION_PATH
. '/configs/application.ini', APPLICATION_ENVIRONMENT);
Zend_Registry::set('config', $this->_config);
Zend_Registry::set('env', APPLICATION_ENVIRONMENT);
// debugging
if($this->_config->debug) {
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 'on');
}
}
protected function _initAutoload()
{
$moduleLoader = new Zend_Application_Module_Autoloader(array(
'namespace' => '',
'basePath' => APPLICATION_PATH));
return $moduleLoader;
}
public function _initDB()
{
// Database
if($this->_config->db) {
$dbAdapter = Zend_Db::factory($this->_config->db);
Zend_Db_Table_Abstract::setDefaultAdapter($dbAdapter);
Zend_Registry::set('dbAdapter', $dbAdapter);
}
}
public function _initView()
{
// view and layout setup
Zend_Layout::startMvc(APPLICATION_PATH . '/views/layouts');
$view = Zend_Layout::getMvcInstance()->getView();
}
public function _initFrontController()
{
$frontController = Zend_Controller_Front::getInstance();
$frontController->setControllerDirectory(APPLICATION_PATH .'/controllers');
$frontController->setParam('env', APPLICATION_ENVIRONMENT);
// action helpers
Zend_Controller_Action_HelperBroker::addPath(APPLICATION_PATH .'/controllers/helpers');
}
public function run()
{
$frontController = Zend_Controller_Front::getInstance();
$frontController->dispatch();
}
}
?>
__________________
VillageIdiot can have my babbies ;d
|
|
|
|