You say that you have your forms in the application/forms directory, but then you call your form with a new Form_Login(). When using the autoloader, the underscore gets replaced with the server/system directory separator, meaning it's looking in application/form, not application/forms (note the plural of "form"). Either rename your folder or change the value in the calling code.
In addition to this, you indicate via your require_once call that your file name is LoginForm.php. Assuming you've made the previous naming change, either your file name should be just Login.php or you need to rename your class to be Forms_LoginForm. This is because the autoloader reads the name of the class you are instantiating, and gets the path and file name from it. In this case, Forms/Login.php. It then looks in this file for a class by the same name (Forms_Login) to instantiate.
Jeremy Brown
Senior Web Developer
Spear One
972-661-6038
jbrown@spearone.com
________________________________________
From: Tom Printy [tprinty@mail.edisonave.net]
Sent: Sunday, September 28, 2008 8:14 PM
To: fw-mvc@lists.zend.com
Subject: [fw-mvc] Zend Autoloader and forms
Hello I have a question about zend form and the autoloader.
I have created a directory application/forms to house all my forms
However the AutoLoader cannot find the forms directory. I still have to
do something like
require_once '../application/forms/LoginForm.php';
$form = new Form_Login();
Is there a shortcut I can take so Autoloader can take care of this form
me?
Thanks
-Tom Printy
没有评论:
发表评论