0
votes

Following is my project structure,

enter image description here

In the bootstrap file, am loading modules like this

protected function _initAutoload() {

        $autoloader = new Zend_Application_Module_Autoloader(array(
         'namespace'=>'',
         'basepath'=>APPLICATION_PATH
        )
        );
        return $autoloader;
    }

When I try to access controller, following error is thrown,

Fatal error: Uncaught exception 'Zend_Loader_Exception' with message 'Resource loader requires both a namespace and a base path for initialization' in

Any idea on this?

APPLICATION.INI

[production]

phpSettings.display_startup_errors = 1

phpSettings.display_errors = 1

includePaths.library = APPLICATION_PATH "/../library"

bootstrap.path = APPLICATION_PATH "/Bootstrap.php"

bootstrap.class = "Bootstrap"

appnamespace = "Application"

resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"

resources.frontController.params.displayExceptions = 0

resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"

resources.view.doctype = "XHTML1_STRICT"

resources.db.adapter = PDO_MYSQL;

resources.db.params.host = localhost;

resources.db.params.username = root2;

resources.db.params.password = password;

resources.db.params.dbname = zfalbums;

settings.publicFoderPathRelativeToApplicationPath = "../public_html";

settings.skin.name = "default";

settings.cache.enable = false;

Thanks

3

3 Answers

0
votes

The namespace should be the name of the module. As you don't show any modules listed, you may not even need the module autoloader. However, try "default" as the namespace, though you may need to prefix everything with this (i.e. class Default_IndexController extends Zend_Controller_Action).

0
votes

First: if you are using a reasonably current version of ZF this is redundant code. Comment it out and things should work.

Second: the only module you are showing in your structure would be 'default'.

It looks like you might be working with Rob Allens ZF 1.x tutorial, if so make sure you have the current version.

To enable modules check this out (from Rob Allen)

[EDIT] To fix your database issue make sure you have at least these lines in your application.ini:

;Database Settings
;*****************
resources.db.adapter = "pdo_Mysql" //your database adapter
resources.db.params.username = "your_username"
resources.db.params.password = "your_password"
resources.db.params.dbname = "your_db_name"

remember this database needs to exist before you try to connect to it (or you could create it with a script). PHPmyadmin works well for easily managing mysql.

0
votes

Your getting following error

Fatal error: Uncaught exception 'Zend_Loader_Exception' with message 'Resource loader requires both a namespace and a base path for initialization' in

Because in your bootstrap you've loading base path as 'basepath'=>APPLICATION_PATH this should to be 'basePath' => APPLICATION_PATH