No idea why it would be throwing that, unless you're including the file
twice.
The only file you need to manually include/require is the autoloader.
After setting up the resource loader, you can simply do:
$form = new Application_Form_ContactForm;
You'd have to rename the classes accordingly.
If you don't want to use the resource loader, then you'll have to include
APPLICATION_PATH in your include path. Keeping your include path as short as
possible is generally a good idea though.
Your bootstrap would look something like this:
<?php
defined('APPLICATION_ROOT')
|| define('APPLICATION_ROOT',
realpath(dirname(__FILE__).'/..'));
// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH',
APPLICATION_ROOT . '/application');
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH.'/../library'),
get_include_path()
)));
require('Zend/Loader/Autoloader.php');
$loader = Zend_Loader_Autoloader::getInstance();
$loader->setFallbackAutoloader(true);
$loader->suppressNotFoundWarnings(false);
$resourceLoader = new Zend_Loader_Autoloader_Resource(array(
'basePath' => APPLICATION_PATH,
'namespace' => 'Application',
'resourceTypes' => array(
'form' => array(
'path' => 'forms/',
'namespace' => 'Form',
),
'model' => array(
'path' => 'models/',
'namespace' => 'Model',
)
));
$options = array(
'layout' => 'layout', //isn't this the default
'layoutContent' => APPLICATION_PATH.'/views/layouts/',
'contentKey' => 'content' //and this the default too?
);
new DbInitialize();
Zend_Layout::startMvc($option);
/**
* Setup controller
*/
$controller = Zend_Controller_Front::getInstance();
$controller->setControllerDirectory(APPLICATION_PATH.'/controllers');
$controller->throwExceptions(false); // should be turned on in development
time
// run!
$controller->dispatch();
Cheers,
David
--
View this message in context:
http://zend-framework-community.634137.n4.nabble.com/Error-Class-forms-ContactForm-not-found-new-to-Zend-tp3319850p3320613.html
Sent from the Zend Framework mailing list archive at Nabble.com.