I have tried many different ways to solve this that I have found online but they have not worked, so please can someone help me.
I am getting this error
Fatal error: Class 'Admin_Form_Login' not found in pathToProject/modules/admin/controllers/LoginController.php on line 13
my project is
Application
--- modules
------admin
--------controllers
--------forms
--------models
--------views
------default
--------controllers
--------forms
--------models
--------views
------aboutus
--------controllers
--------forms
--------models
--------views etc etc
My Controller
class Admin_LoginController extends Zend_Controller_Action
{
public function init()
{
/* Initialize action controller here */
}
public function indexAction()
{
$form = new Admin_Form_Login();
$this->view->form = $form;
// action body
}
}
My Form
class Admin_Form_Login extends Zend_Form
{
public function init()
{
/* Form Elements & Other Definitions Here ... */
$this->setAction("/admin/index/login")->setMethod("post");
$username = new Zend_Form_Element_Text('username');
$username->setLabel('Username')
->setOptions(array('size' => '30'));
$password = new Zend_Form_Element_Password('password');
$password->setLabel('Password')
->setOptions(array('size' => '30'));
$submit = new Zend_Form_Element_Submit('submit');
$submit->setLabel('Log in')
->setOptions(array('class' => 'submit'));
$this->addElement($username)
->addElement($password)
->addElement($submit);
}
}
MY Bootstrap.php
class Admin_Bootstrap extends Zend_Application_Module_Bootstrap
{
protected function _initAutoload() {
$autoloader = new Zend_Application_Module_Autoloader(array(
'namespace' => 'Admin_',
'basePath' => APPLICATION_PATH."/modules/admin",
));
return $autoloader;
}
}
Here is my App ini maybe something in there
[bootstrap]
Autoloadernamespaces[] = "Admin_"
Autoloadernamespaces[] = "Default_"
Autoloadernamespaces[] = "Aboutus_"
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.frontController.defaultModule = "default"
resources.modules[] = ""
resources.view.encoding = "UTF-8"
resources.view.basePath = APPLICATION_PATH "/views/"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
includePaths.library = APPLICATION_PATH "/../library"
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.frontController.params.prefixDefaultModule = "1"
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"
admin.resources.layout.layout = layout
admin.resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"
default.resources.layout.layout = default
default.resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"
[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
and my view
$this->form
Thanks for any help.
I added the following in the production part ok my application.ini and it started worked Not sure why.
Autoloadernamespaces[] = "Admin_"
Autoloadernamespaces[] = "Default_"
Autoloadernamespaces[] = "Aboutme_"
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.frontController.defaultModule = "default"
resources.modules[] = ""
resources.view.encoding = "UTF-8"
resources.view.basePath = APPLICATION_PATH "/views/"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
Admin_Bootstrap
, presumably stored inapplication/modules/admin/Bootstrap.php
, extendsZend_Application_Module_Bootstrap
, which registers its own resource autoloader. You could probably remove your customAdmin_Bootstrap::_initAutoload()
method. – David Weinraubapplication/modules/admin/forms/Login.php
? – Tim Fountain