I am getting this error what should I do ?
Fatal error: Class 'forms_AuthForm' not found in C:\dev\workspaces\
adxweb\application\adxsearch\modules\account\controllers\
AuthController.php on line 26
I have one AuthForm.php
in forms
folder and Authcontroller.php
in controllers
folder, and auth.phtml
in scripts
folder.
Thanks kiran
Try
$form = new Application_Form_AuthForm()
instead of$form = new forms_AuthForm()
in your controller fileAuthController.php
and make sure that you have
class Application_Form_AuthForm extends Zend_Form
in yourforms/authform.php
.If you want to remove the namespace
Application
then in yourapplication.ini
file setappnamespace = "Application"
toappnamespace =
If you use modular directory structure:
Then no additional setup is needed, except
resources.modules[]=
inapplication.ini
and a module bootstrap formodulename
module.The default path for forms in ZF projects is
APPLICATION_PATH
/forms, like this:If you wish to place your forms elsewhere, you will need to tell Zend where that location is (it can be done in the bootstrap or, I think, in application.ini).
Also, make sure your classes are named appropriately, as they reflect the paths to the files they're contained in. The names are case sensitive.
[EDIT]
Read this article: http://bsagols.wordpress.com/2010/08/12/zend_loader_autoloader-stand-alone-and-modular-approaches/ - it describes what you appear to be after (modular approach, with per-module forms).
This is the long way around though. The way I'd solve it is moving your forms to
application/forms
. You can create module-specific folders there, like this:You form class name would then be
Namespace_Form_Auth_Auth
, whereNamespace
is your application namespace. This approach requires no modifications to the bootstrap or application.ini.