Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
251 views
in Technique[技术] by (71.8m points)

php - How to add a view helper directory (zend framework)

I begin with ZF (1.9.7), and I want to use View Helpers from a library shared between all my projects. But I can't find how to add it directory to the helpers path. My herpers works fines when I put them in application's helpers path.

Here is the error, where I find the path to ZF helpers, and path to the applications ones.

object(ArrayObject)#71 (3) {
  ["exception"]=>
  object(Zend_Loader_PluginLoader_Exception)#70 (6) {
    ["message:protected"]=>
    string(151) "Plugin by name 'Voo' was not found in the registry; used paths:
Zend_View_Helper_: Zend/View/Helper/;C:/ZendStd/www/applis/VOO4_PROJECTX/viewshelpers/"
    ["string:private"]=>
    string(0) ""
    ["code:protected"]=>
    int(0)
    ["file:protected"]=>
    string(89) "C:Program FilesendendServershareendFrameworklibraryendLoaderPluginLoader.php"
    ["line:protected"]=>
    int(401)

Best regards
Cédric

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

It can be done very easily with the built in Zend_Application resource for the view. If you're using ini configs, add a line like this:

resources.view.helperPath.My_View_Helper = "My/View/Helper"

The end of the key is the class name prefix, and the value the path where they reside.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...