开发者

Zend modules with form

开发者 https://www.devze.com 2023-02-18 18:14 出处:网络
I am new to Zend Framework. I am using modules for front end and admin panel. In the admin panel, I would like to have login form, then the folder structure is

I am new to Zend Framework. I am using modules for front end and admin panel.

In the admin panel, I would like to have login form, then the folder structure is

application/

         modules/
                 backend/
                       controllers/
                             LoginController.php
                       forms/
                             LoginForm.php
                       views/
                             scripts/
                                     login开发者_如何学编程/
                                           index.phtml

I am having an error "Fatal error: Class 'Backend_Forms_LoginForm' not found in D:\wamp\www\ioc\Application\modules\backend\controllers\LoginController.php on line 9"

Please help me to fix this.

Thanks.

I created controller and forms using following URL http://weierophinney.net/matthew/archives/165-Login-and-Authentication-with-Zend-Framework.html

In the controller, it call the form by

return new Backend_Forms_LoginForm(array( 'action' => '/login/process', 'method' => 'post', ));

Please help me to fix this.


If you're using standard autoloading, your form's class should be named exactly Backend_Form_LoginForm ('form' in singular).

Also make sure that you have a bootstrap for Backend module in place.


I don't know why it won't work... it sould... by the way, a lot of developers that I met use to put all the forms into the default form directory or into the Library directory, so the can change the name as they prefer without doing includes or something else.

in your case you can try create /library/backend/forms and write the form in the same way as you writed

0

精彩评论

暂无评论...
验证码 换一张
取 消