2

Given:

1.
bootstrap:

$autoloader = Zend_Loader_Autoloader::getInstance();// Zend_Loader_Autoloader
$autoloader->registerNamespace('Ntk_');

equals to

application.ini:
autoloaderNamespaces[] = "Ntk_"


2.
bootstrap:

$pluginLoader = $this->getPluginLoader();// Zend_Loader_PluginLoader     
$pluginLoader->addPrefixPath('My_Resource', APPLICATION_PATH . "/appResourcePlugins");

equals to

application.ini:
pluginPaths.My_Resource = APPLICATION_PATH "/appResourcePlugins"


3.
bootstrap:

$moduleAutoloader = $this>getResourceLoader();//Zend_Application_Module_Autoloader      
$moduleAutoloader->addResourceType('need', 'needs', 'Needs');

equals to

application.ini:
???



What is the application.ini method for configuring Zend_Application_Module_Autoloader ?
(...if it exists)
I use zend framework version 1.11.10

tereško
  • 58,060
  • 25
  • 98
  • 150
Catalin Enache
  • 758
  • 1
  • 10
  • 17

1 Answers1

-1

Maybe this example will help you:

    <?php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{

protected function _initApplication()
{
$this->bootstrap('frontcontroller');
$front = $this->getResource('frontcontroller');
$front->addModuleDirectory(dirname(__FILE__) . '/modules');
}

protected function _initDoctype()
{
$this->bootstrap('view');
$view = $this->getResource('view');
$view->doctype('XHTML1_STRICT');
}
}

Here is application.ini

[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.modules = ""

resources.layout.layout = "layout"
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts"
resources.view[] =

[staging : production]

[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1

[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1 

Reference:someone had the same question and got his answer here

Robert
  • 1,117
  • 8
  • 10
  • the line: `resources.modules = ""` only unleash Zend_Application_Resource_Modules wich is an application resource plugin that will handle my other modules bootstraping process, where my other modules could be found in `resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"`. But if i want to add a controller action helper, for example, how do i do that in application.ini? In know i can do that in bootstrap like: `$loader = $this->getResourceLoader(); $loader->addResourceType('helper', 'helpers', 'Helper');` – Catalin Enache Aug 26 '11 at 07:20
  • 1
    resources.frontController.actionhelperpaths.My_Action_Helper = "My/Action/Helper" reference [link](http://www.zfforums.com/zend-framework-general-discussions-1/general-q-zend-framework-2/how-register-action-helpers-application-ini-3005.html) – Robert Aug 26 '11 at 07:42
  • thanks for verry useful answer: `resources.frontController.actionhelperpaths.My_Action_Helper = "My/Action/Helper"` but, this limits me only to add action helpers resources. In bootstrap i can have: `$this->getResourceLoader()->addResourceType('customType', 'customResourceFolder', 'CustomPrefix');` and i should be able to instantiate `$customObj = new Application_CustomPrefix_Hello();` which should have been defined in APPLICATION_PATH . "customResourceFolder/Hello.php". This object could be anything , not necessary an action helper. – Catalin Enache Aug 26 '11 at 08:22
  • I do not have a 1:1 class name | directory path relationship. If i had that I should add a path to include_path but having not 1:1 equivalence i can use `$this->getResourceLoader()->addResourceType('customType', 'customResourceFolder', 'CustomPrefix');` in order to have access to classes that do not follow PEAR naming standards. Can this be done in application ini? – Catalin Enache Aug 26 '11 at 08:27
  • I don't know, it is over my knowledge to answer your question.Sorry! – Robert Aug 26 '11 at 09:04
  • After some digging my conclusion is that by default it is not possible.All settings in application.ini others than those beggining with word 'resources' are handled either by Zend_Application or Zend_Application_Bootstrap_Bootstrap. In Zend_Application_Bootstrap_Bootstrap in __construct there is an option 'resourceloader' that should handle what i need but it does not. The parameter required for that setting must be a Zend_Loader_Autoloader_Resource instance object. I think it is not possible to pass an object instance as parameter in an application.ini setting. – Catalin Enache Aug 26 '11 at 13:42
  • Also [here](http://habnichts.blogspot.com/2009/07/zend-framework-18-applicationini_23.html) says that this is not possible. – Catalin Enache Aug 26 '11 at 13:42