开发者

zend module not loading library

开发者 https://www.devze.com 2023-01-24 16:54 出处:网络
My application.ini looks like this: phpSettings.display_startup_errors = 0 phpSettings.display_errors = 0

My application.ini looks like this:

phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
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.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.modules = ""
resourceses.includePaths.library = APPLICATION_PATH "/../../library"
resources.layout.layout = layout
admin.resources.layout.layout = admin

index.php looks like this

<?php

// Define path to application directory
defined('APPLICATION_PATH')
        || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));

// Define application environment
defined('APPLICATION_ENV')
        || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'development'));

// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
            realpath(APPLICATION_PATH . '/../library'),
            get_include_path(),
        )));

set_include_path(implode(PATH_SEPARATOR, arr开发者_开发百科ay(
            realpath(APPLICATION_PATH . '/../../library'),
            APPLICATION_PATH . '/modules/admin/models',
            get_include_path(),
        )));


/** Zend_Application */
require_once 'Zend/Application.php';

// Create application, bootstrap, and run
$application = new Zend_Application(
                APPLICATION_ENV,
                APPLICATION_PATH . '/configs/application.ini'
);
$application->bootstrap()
        ->run();

My application/bootstrap.php looks like this:

<?php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap {

    protected function _initAutoload() {
        $autoloader = new Zend_Application_Module_Autoloader(array(
                    'namespace' => 'Admin_',
                    'basePath' => dirname(__FILE__) . '/modules/admin'
                ));
    }

}

And finally my module Bootstrap looks like this:

<?php

class admin_Bootstrap extends Zend_Application_Module_Bootstrap {

}

I am trying to develop and administrator module. I have it set up under the folder application/modules. I get this error:

Warning: include_once(Zend\Paginator\Adapter\Select.php) [function.include-once]: failed to open stream: No such file or directory in E:\wamp\www\industrial\library\Zend\Loader.php on line 146

Warning: include_once() [function.include]: Failed opening 'Zend\Paginator\Adapter\Select.php' for inclusion (include_path='E:\wamp\www\industrial\application/../library;;E:\wamp\www\industrial\application/modules/admin/models;E:\wamp\www\industrial\library;.;C:\php5\pear') in E:\wamp\www\industrial\library\Zend\Loader.php on line 146

Fatal error: Class 'Zend_Paginator_Adapter_Select' not found in E:\wamp\www\industrial\application\modules\admin\controllers\UsersController.php on line 11

Can't understand what is wrong. PS: i have used this tutorial to set up the module


There's no need to add include path to modules.

This is not needed at all:

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

But ensure that this include path contains the path to Zend Framework library.

Probably you are missing:

resources.modules[] = 

in application.ini.


In addition to what takeshin said, you are NOT obeying the naming conventions....
Class names must always start with Uppercase Letter.

So change...

class admin_Bootstrap extends Zend_Application_Module_Bootstrap {}

to

class Admin_Bootstrap extends Zend_Application_Module_Bootstrap {}

Your way might work on windows but on linux it'll die...


Comment this line

resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
0

精彩评论

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

关注公众号