Zend Framework Hello World

June 5, 2008 by hejian

Folder Skeleton

hello_world
application
controllers
indexController.php
modules
views
scripts
index
index.phtml
library
public
index.php

index.php

ini_set('include_path', ini_get('include_path') . ':../library');
/* Zend Loader */
require "Zend/Loader.php";
/* Required Classes */
Zend_Loader::loadClass('Zend_Controller_Front');
/* Setup Controller */
$front = Zend_Controller_Front::getInstance();
$front->setControllerDirectory('../application/controllers');
$front->throwExceptions(true);
/* GO! */
$front->dispatch();

indexController.php

class IndexController extends Zend_Controller_Action {
function indexAction() {
$this->view->world = 'World!';
}
}

index.phtml

Hello <?=$this->world?>

Leave a Reply

You must be logged in to post a comment.

Wordpress template made by HeJian