-- Ed West <[EMAIL PROTECTED]> wrote
(on Tuesday, 30 September 2008, 09:06 PM -0700):
> I'm still having problems, though what you suggested made a difference. Now I
> have:
>
> $this->view->addHelperPath('/home/ewest/project/library/Zend/View/Helper');
> $this->view->addHelperPath('/home/ewest/project/application/views/helpers',
> 'My_Helper');
>
> My test page uses Zend_View_Helper_Layout, Zend_View_Helper_Doctype, and my
> own
> My_Helper_Url class. All three helpers are working. However, these errors
> are
> getting thrown:
>
> Error number: 2 Error string: fopen(/home/ewest/project/application/views/
> helpers/Doctype.php) [function.fopen]: failed to open stream: No such file or
> directory
> Error number: 2 Error string: fopen(/home/ewest/project/application/views/
> helpers/Layout.php) [function.fopen]: failed to open stream: No such file or
> directory
>
> Again, those two helpers are working-- the correct helpers are first getting
> loaded from '/home/ewest/project/library/Zend/View/Helper'. But it looks like
> the plugin loader is attempting to load the classes again from /home/ewest/
> project/application/views/helpers, which causes the errors.
This is fine, normal, and expected.
Within Zend_Loader::isReadable(), we use fopen() with its third
parameter to allow searching the include_path; this is many, many times
faster than manually looping over paths.
However, fopen() emits a warning when it is unable to find a file.
We suppress this warning from display with the '@' operator, but if you
are using the PHP error_log, it will still get logged.
So, basically... all is working as expected. Nothing to see here, move
along...
> On Tue, Sep 30, 2008 at 8:46 AM, Matthew Weier O'Phinney <[EMAIL PROTECTED]>
> wrote:
>
> -- Ed West <[EMAIL PROTECTED]> wrote
> (on Tuesday, 30 September 2008, 07:50 AM -0700):
> > I'm having trouble using Zend_View::addHelper to add additional helper
> paths.
> > I have a project that lives in /home/ewest/project . The standard
> > Zend_View_Helper classes live under /home/ewest/project/library/Zend/
> View/
> > Helper. /home/ewest/project/library is also part of my PHP include
> path.
> My
> > own helper classes reside under /home/ewest/project/application/views/
> helpers.
> > There, I have my own Url helper class that should override the standard
> > Zend_View_Helper_Url-- my version takes a string argument instead of an
> array.
> >
> > In my base action class's initView method, I call:
> > $this->view->addHelperPath('/home/ewest/project/library/Zend/View/
> Helper', '');
> > $this->view->addHelperPath('/home/ewest/project/application/views/
> helpers',
> > '');
>
> Zend_View does not allow adding helper paths with blank prefixes. Either
> omit the second argument (the prefix 'Zend_View_Helper' will be
> assumed), or specify your custom prefix. This will likely correct the
> issue you're observing.
>
> > However, I get errors like this on my test page:
> > Error number: 2 Error string:
> fopen(/home/ewest/project/application/views
> /
> > helpers/Doctype.php) [function.fopen]: failed to open stream: No such
> file or
> > directory Error file: /home/ewest/project/library/Zend/Loader.php Error
> line:
> > 160
> >
> > If I remove the second call to addHelper, then I end up with the error:
> > Catchable fatal error: Argument 1 passed to Zend_View_Helper_Url::url()
> must be
> > an array, string given
> >
> > It seems that only one path is being used at a time instead of both.
> I've
> > checked the documentation-- does anyone have any idea what's going
> wrong?
>
> --
> Matthew Weier O'Phinney
> Software Architect | [EMAIL PROTECTED]
> Zend Framework | http://framework.zend.com/
>
>
--
Matthew Weier O'Phinney
Software Architect | [EMAIL PROTECTED]
Zend Framework | http://framework.zend.com/