Deal of the Day

Home » Main » Manning Forums » 2007 » Zend Framework in Action

Thread: Guidelines to redo Chapters 3 and 4 with ZF 1.10?

Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 1 - Pages: 1 - Last Post: Jun 13, 2010 2:34 PM by: fdrouillard
fdrouillard

Posts: 10
From: Novato, CA
Registered: 2/21/10
Guidelines to redo Chapters 3 and 4 with ZF 1.10?
Posted: Jun 11, 2010 6:43 PM
  Click to reply to this thread Reply

Is it possible to provide some guidelines on how to re-do chapters 3 and 4 for ZF 1.10?

I'm really stuck on getting from:

(old)config.ini to (new)application.ini
(old)index.php to (new)index.php
(old)bootstrap.php to (new)Bootstrap.php.

It'd be much appreciated...thanks!

What happened to my reply to this message that contained additional information!
Message was edited by:
fdrouillard

fdrouillard

Posts: 10
From: Novato, CA
Registered: 2/21/10
Re: Guidelines to redo Chapters 3 and 4 with ZF 1.10?
Posted: Jun 13, 2010 2:34 PM   in response to: fdrouillard in response to: fdrouillard
  Click to reply to this thread Reply

I'm new to programming in PHP and want to learn using Zend Framework 1.10.4, which differs from the version used in the book.

Zend_Tool was used to create the "places" project, and it created the files places/public/index.php, places/application/configs/application.ini and places/application/Bootstrap.php.

I would like to modify these files as necessary to replace the book versions of places/public/index.php, places/application/config.ini and places/application/bootstrap.php.

My places/public/index.php file is a follows:

// places/public/index.php

<?php

// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));

// Define application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'development'));

// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../library'),
get_include_path(),
)));

/** Zend_Application */
require_once 'Zend/Application.php';

// Create application, bootstrap, and run
$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini'
);

$application->bootstrap()
->run();

My places/application/configs/application.ini file is:

; places/application/configs/application.ini

[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
includePaths.library = APPLICATION_PATH "/../library"
includePaths.models = APPLICATION_PATH "/../models"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"

resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.params.displayExceptions = 0

db.adapter = PDO_MYSQL
db.params.host = localhost
db.params.username = nan
db.params.password = cooper
db.params.dbname = places
date_default_timezone = "America/Los_Angeles"
debug = 0

[staging : production]

[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1

[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1

db.params.dbname = places_test

My questions -- Are all of the methods from the book version of bootstrap.php still necessary to add to a registry object? Should they be added to the ZF1.10.4 version of Bootstrap.php created by Zend_Tool?

Is the configureFrontController() method in the book version of bootstrap.php still necessary, or has it been replaced by the resources configuration lines in the ZF1.10.4 application.ini file?

Is the runApp() method in the book version of bootstrap.php still necessary, or has it been replaced by $application->bootstrap()->run(): line in the ZF1.10.4 public/index.php file?

Is the __construct() method of the book version of the bootstrap.php file still necessary to load configuration data into a registry object? Should it be located in places/application/configs/application.ini or places/public/index.php?

Back to the __construct() method in the book version of bootstrap.php file. Why are two objects needed, namely both $configSection and $config? Does the default time zone have to be set again, or is specifying it in the places/appllication/configs.ini file adequate?

More on the __construct method() in the book version of bootstrap.php. Do we still need to specify debug = 0 and debug = 1 in sections (names revised) [production] and [testing]? Are the phpSettings adequate for that purpose?

Sorry for the long-winded questions, but I'm having real problems getting through Chapter 3.

Legend
Gold: 300 + pts
Silver: 100 - 299 pts
Bronze: 25 - 99 pts
Manning Author
Manning Staff
Manning Developmental Editor