hiiiiiiiiii,
really no one can help me? I have to leave zend.. :(  uhhh

I' following *zend framework in action ebook* from allen rob, I created
index.php, bottstrap.php,..like in ebook..* I created plugins*.. yes my
problem is with these plugins!, but not in main indexController, *in modules
*... when I wat a module (admin) .. oh an error occurs :

 when http://localhost/test/public/admin/index/index::
--  *PHP Fatal error:  Call to a member function hasPluginResource() on a
non-object in
/usr/local/zend/apache2/htdocs/test/application/controllers/ErrorController.php
*

:((
took one week time search around web,... :( !!! :(((((((((((((


public/index.php

include '../application/bootstrap.php';
$configSection = getenv('PLACES_CONFIG') ? getenv('PLACES_CONFIG') :
'general';

$bootstrap = new Bootstrap($configSection);
$bootstrap->runApp();


 ----------------bootstrap.php

class Bootstrap
{

    public function __construct($configSection)
    {
        $rootDir = dirname(dirname(__FILE__));

        define('ROOT_DIR', $rootDir);
        set_include_path(get_include_path()
        . PATH_SEPARATOR . ROOT_DIR . '/library/'
        . PATH_SEPARATOR . ROOT_DIR .
         '/application/models/'
         );

         require_once 'Zend/Loader/Autoloader.php';
         $loader = Zend_Loader_Autoloader::getInstance();
         $loader->registerNamespace('App_');
         $loader->setFallbackAutoloader(true);
         $loader->suppressNotFoundWarnings(false);

         //
http://devzone.zend.com/article/4525-Developing-a-Comprehensive-Autoloader

         //
http://akrabat.com/zend-framework/zend_loaders-autoloader_deprecated-in-zend-framework-18/
         $resourceLoader = new Zend_Loader_Autoloader_Resource(array(
                                                             'namespace' =>
'Application_',
                                                             'basePath'  =>
ROOT_DIR .'/application/'
                                                             ));


 $resourceLoader->addResourceTypes(array(
                                         'Model' => array('path' =>
'models', 'namespace' => 'Model'),
                                         'DbTable'  => array('path' =>
'models/DbTable', 'namespace' => 'DbTable'), )
                                                             );


                                                             // Load
configuration


 Zend_Registry::set('configSection', $configSection);

                                                             $config = new
Zend_Config_Ini(ROOT_DIR.'/application/config.ini', $configSection);

 Zend_Registry::set('config', $config);

 date_default_timezone_set($config->date_default_timezone);
                                                             // configure
database and store to the registry

                                                             $db =
Zend_Db::factory($config->db);


 Zend_Db_Table_Abstract::setDefaultAdapter($db);

 Zend_Registry::set('db', $db);

    }
    public function _initControllerPlugins()
    {
        // register the plugins
        Zend_Controller_Front::getInstance()->registerPlugin(new
Reseller_Controller_Plugin_ActionSetup(), 98);
        Zend_Controller_Front::getInstance()->registerPlugin(new
Reseller_Controller_Plugin_ViewSetup());
        Zend_Controller_Front::getInstance()->registerPlugin(new
Reseller_Controller_Plugin_ModelDirSetup());
    }

    public function configureFrontController()
    {
        $frontController = Zend_Controller_Front::getInstance();
        $frontController->setControllerDirectory(ROOT_DIR
.'/application/controllers');
    }


    public function runApp()
    {
        $this->_initControllerPlugins();
        $this->configureFrontController();
        $frontController = Zend_Controller_Front::getInstance();

        // setup the layout
        Zend_Layout::startMvc(array('layoutPath' => ROOT_DIR.
'/application/layouts/scripts'));

        $frontController->throwExceptions(false);
        $frontController->setParam('useDefaultControllerAlways', true);
        $frontController->setControllerDirectory(ROOT_DIR .
'/application/controllers');
        $frontController->addModuleDirectory(ROOT_DIR .
'/application/modules');

        // run!
        $frontController->dispatch();

    }



}



-------------- config.ini

db.adapter = PDO_MYSQL
db.params.host = 127.0.0.1
db.params.username = root
db.params.password = 12345
db.params.dbname = test

date_default_timezone = "Europe/London"

[live : general]
[dev : general]

[test : general]

db.params.dbname = test_test


------------

:)
Thanks,
Shahrzad

Reply via email to