Zend自动加载器

I am trying to autoload the forms found in my project under application/forms/*.php ( in this case, LoginForm.php ).

How do I configure Zends autoloader to load this form automatically? As I don't want to use ugly namespaces I am enabling the fallback in my bootstrap. I haven't got anything related to forms configured in my application.ini

thanks!

The default autoloader will load this for you. Make sure that you have checked the following:-

  1. Your file is application/forms/Loginform.php
  2. The file contains something like this:-

    class Application_Form_Loginform extends Zend_Form
    {
       //Take special note of the capitalisation - it is important
       // Also note it is Form NOT Forms
        public function init()
        {
            //Your code here
        }
    }
    
  3. Call your class like this:-

    $form = new Application_Form_Loginform();
    

Take extra care over letter case, it is important that you get it exactly right or the autoloader will not find you class and will complain.

Not sure if this answers your question, as its a little vague, but try the following.

In your bootstrap:

protected function _initAppAutoload()
{
    $moduleLoad = new Zend_Application_Module_Autoloader(array(
       'namespace' => '',
       'basePath'   => APPLICATION_PATH
    ));
}

Obviously then the Form_LoginForm() class would exist in application/forms/LoginForm.php