Zend Framework autoloader question

In the zend framework, I register my namespace like this (in application.php):

'autoloaderNamespaces' => array(
    'Cms_'
)

And after that - I would expect Zend to always check this path in addition to Zend and ZendX if an unknown class is called. But for some reason this does not work, for example, with view helpers.

I still need to register a separate path for my helpers in the view, even if the view's welcome scripts are named according to the Zend coding standards and are located in:

Cms/View/Helper/

And this is how I register the auxiliary path in the configuration file:

view' => array(
    'charset' => 'UTF-8',
    'doctype' => 'XHTML1_TRANSITIONAL',
    'helperPath' => array(
        'Cms_View_Helper_' => 'Cms/View/Helper'
        )
),

- , Cms 'autoloaderNamespaces', View "helperPath"? Cms Cms/View/Helper?

- :)

+3
3

, , , :

, "View_Helper" : "My_View_Helper_SpecialPurpose". ( addHelperPath() setHelperPath()).

, . , , , .. "MyApp_", "MyOtherApp".
+1
+4

application.ini.

autoloaderNamespaces.Foo = "Foo"
includePaths.library = APPLICATION_PATH "/../library"

"Foo" - library/Foo. , , "Foo" .

I need to add a separate list of helpers to the default list for my view, otherwise the view will not look in this directory to match the view helpers. I am thinking of loading prominent helpers as a direct open. The view needs explicit instructions on where to look for helpers.

+2
source

Source: https://habr.com/ru/post/1794925/


All Articles