I am having issues.
I am readying through: Practical Web 2.0 Applications with PHP.
I am stuck on a part in chapter 2 involving the "CustomControllerAction.php" file (for those of you how own the book or you can check it out here
Apress Practical Web 2 0 Applications with PHP Dec 2007)
Anyway it isn't working. Even the example code doesn't seem to work.
I've been looking up the zend framework docs and believe he is using a subclass or action controller. Anyway my main class extends the CustomControllerAction class (which in turn extends the Zend_Controller_Action), but when I load the page the script can't find the CustomControllerAction class.
Included are the is the code for my bootstrap file, registration class file and customcontrolleraction file:
bootstrap:
Code:
<?php
//Error Reporting
error_reporting(E_ALL|E_STRICT);
ini_set('display_errors', 'on');
//modify include path to include path to library
ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . '../library');
//Zend Framework include
require_once 'Zend/Loader.php';
Zend_Loader::registerAutoload();
//Initialize config
$config = new Zend_Config_Ini('../application/config.ini', 'development');
//Get the front controller instance
$front = Zend_Controller_Front::getInstance();
$front->setControllerDirectory('../application/controllers');
$db = Zend_Db::factory($config->database->type, array(
'host' => $config->database->hostname,
'username' => $config->database->username,
'password' => $config->database->password,
'dbname' => $config->database->merit_optemail
));
if ($config->developer) {
$front->throwExceptions(true);
} else {
$front->throwExceptions(false);
}
$front->dispatch();
?>
registration:
Code:
<?php
/**
*
*/
class RegisterController extends CustomControllerAction
{
public function indexAction()
{
$this->view->name = strip_tags($_POST['customer_name']);
}
}
?>
custom controller action:
Code:
<?php
/**
*
*/
class CustomControllerAction extends Zend_Controller_Action
{
public $db;
public function init()
{
$this->db = Zend_Registry::get('db');
}
}
?>
dir structure:
home/
home/public_html <-- this is where the bootstrap index.php file is
home/application <-- this is where the CustomerControllerAction.php file is
home/application/controllers <-- controllers
home/library/zend <-- zend files
Let me know if more info is needed.