1
votes

I have following structure in my Zend-Project :

-application
      -   PDF
      -   configs
      -   controllers
      -   models
      -   views
      -   Bootstrap.php
-library
-public
-tests

I have created a new folder PDF inside application folder. And I have write some classes inside it[PDF].

What I want is to access this classes inside the indexAction() of the IndexController, but it showing an error like :

"Class 'Application_PDF_FormDocument' not found in D:\xampp\htdocs\zendapp\application\controllers\IndexController.php on line 13"

What may be the possible reason?

Please provide some help.....

Thanks In Advance......

2
@Fatmuemoo and @ChanibaL : It is working perfectly for me now, thanks once again......Pushpendra

2 Answers

2
votes

I agree with ChanibaL regarding the naming of your classes. you should be naming it PDF_FormDocumnet. Next, in application.ini, regerster the namespace:

autoloaderNamespaces[] = "PDF_"

Lastly, in your index.php make sure you are adding it to the include path:

set_include_path(implode(PATH_SEPARATOR, array(
    realpath(APPLICATION_PATH . '/../library'),
    realpath(APPLICATION_PATH),
    get_include_path(),
)));

That should do the trick

1
votes

If you have a standard autoloader in your application, the class name should be PDF_FormDocument (no Application_ part!) in the file application/PDF/FormDocument.php

If this doesn't help by itself try adding

    protected function _initAutoload() {
            $autoloader=new Zend_Application_Module_Autoloader(array(
                    'namespace' => 'PDF',
                    'basePath' => dirname(__FILE__).DIRECTORY_SEPARATOR.'PDF'
            ));

to application/Bootstrap.php