views:

410

answers:

2

I am following this tutorial on Zend Forms. I copied it verbatim and I got this error

Fatal error: Class 'forms_ContactForm' not found in /Quickstart/application/controllers/IndexController.php on line 10

Which led me to believe it wasn't loading in the class, so I added this into my IndexController.php file

Zend_Loader::loadClass('forms_ContactForm');

This is the main error I am receiving, I believe it is because it cannot locate my form_ContactForm.php file and I am unsure why.

This is my hierarchy of folders:
Quickstart
   application
      controllers
      forms
      layouts
      views
   library
   public
link to full error text

Any help would be appreciated,
Levi

+1  A: 

Your include path is set to:

. (relative to current directory)
/usr/lib/php
/usr/local/lib/php
../library'

Since your "forms" folder is not directly under any of the above include paths that include command won't work.

To fix this, add the /application/ directory to your include path and try again.

Shane
+1  A: 

As Shane said, you should include your "application" folder in your include path. This should be done in your "index.php" bootstrap file :

set_include_path(
    '/paht/to/application' 
    . PATH_SEPARATOR . get_include_path()
);

Moreover, you can tell Zend Framework to autoload all classes by adding this to your bootstrap file :

Zend_Loader::registerAutoload();

This will save you from having to load manuall each class you use.

Wookai