1.
Listing 2.1: web_root/index.php
error_reporting(E_ALL|E_STRICT); |#1
ini_set('display_errors', true); |
date_default_timezone_set('Europe/London'); |
$rootDir = dirname(dirname(__FILE__));
Licensed to Menshu You
Please post comments or corrections to the Author Online forum at
http://www.manning-sandbox.com/forum.jspa?forumID=329
set_include_path$rootDir . '/library' |#2
. PATH_SEPARATOR . get_include_path()); |
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Debug');
Zend_Loader::loadClass('Zend_Controller_Front');
// setup controller
$frontController = Zend_Controller_Front::getInstance(); #3
$frontController->throwExceptions(true); #4
$frontController->setControllerDirectory('../application/controllers');
// run!
$frontController->dispatch();
(annotation) <#1: Setup environment>
(annotation) <#2: Set the path>
(annotation) <#3: Zend_Controller_Front is a Singleton>
(annotation) <#4: Throw exceptions. Don??™t do this in production!>
Let??™s look at this file in more detail. Most of the work done in the bootstrap is initialization of one form or
another. Initially, the environment is set up correctly (#1) to ensure that all errors or notices are displayed.
PHP 5.1 introduced new time and date functionality that needs to know where in the world we are.
Pages:
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48