index.php (located in the root directory)
Code: Select all
<?php
//Set up the environment
error_reporting(E_ALL|E_STRICT);
ini_set('display_errors', true);
date_default_timezone_set('America/New_York');
//Set the app path
$rootDir = dirname(dirname(__FILE__));
set_include_path($rootDir . '/library'
. PATH_SEPARATOR . get_include_path());
//Get the loader and load the classes
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Debug');
Zend_Loader::loadClass('Zend_Controller_Front');
//Get the Front Controller
$frontController = Zend_Controller_Front::getInstance();
$frontController->setControllerDirectory('../application/controllers');
//Run the <span style='color:blue' title='I'm naughty, are you naughty?'>smurf</span>!
$frontController->dispatch();
Code: Select all
<?php
class IndexController extends Zend_Controller_Action {
public function indexAction() {
$this->view->assign('title', 'Hello World!');
}
}
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>
<?php echo $this->escape($this->title);?>
</title>
</head>
<body>
<h1><?php echo $this->escape($this->title);?></h1>
</body>
</html>
Warning: require_once(Zend/Loader.php) [function.require-once]: failed to open stream: No such file or directory in /Users/Wedgewheel/Sites/zfTest/index.php on line 11
Fatal error: require_once() [function.require]: Failed opening required 'Zend/Loader.php' (include_path='/Users/Wedgewheel/Sites/library:.:/usr/local/php5/lib/php') in /Users/Wedgewheel/Sites/zfTest/index.php on line 11
WHY DOES GOD HATE ME?!?!