Where can I save my files when creating a plugin in zend?

This is probably the most unpleasant part for beginners learning zend.

Where can I create a file of a new class?

Here is an example: http://forums.zend.com/viewtopic.php?f=69&t=4988

or another: http://framework.zend.com/manual/1.11/en/zend.controller.plugins.html

But none of them mention where this plugin should be created?

+3
source share
2 answers

The best idea is to place your classes where the autoloader can find them. It is also a pseudo convention that mimics the structure of the Zend class names.

For example, suppose you created a controller plugin called "Foo". Name class

class My_Controller_Plugin_Foo extends Zend_Controller_Plugin_Abstract

and save the file to library/My/Controller/Plugin/Foo.php.

"My" ( , PHP 5.3), application.ini

autoloaderNamespaces.My = "My_"

, "" . "library" .

+4

application.ini

resources.frontController.plugindirectory = APPLICATION_PATH "/plugins"

autoloaderNamespaces[] = "My_"
resources.frontController.plugins.MyPlugin = 
                          "My_Controller_Plugin_MyPlugin"

,

/path/to/library/My/Controller/Plugin/MyPlugin.php

zend.

+4

All Articles