2009年7月22日星期三

Re: [fw-mvc] Add custom View Helpers

Hello Paddy,

Concerning the errors:

Matthew Weier O'Phinney wrote:

Actually, looking more closely at the messages, I can see what's going
on right here... and nothing broke.

The PluginLoader, which is used by Zend_View to locate helpers, iterates
over the various paths attached to it, and does an isReadable check for
the class file on each include path until it finds the one that works.

Inside Zend_Loader, we reset the include_path briefly, and then use
fopen() to search against it -- fopen() tries to open the file against
the include_path, which is faster than iterating over all include paths.

However... fopen(), in addition to returning false on failure, also
emits an E_WARNING. We suppress that -- but if you are logging errors,
they'll still show up in the error log.

Does the layout script still render? or are you perhaps using the new
"scream" extension (which suppresses... error suppression)?

> Debug Warning: /domain.com/library/Zend/Loader.php line 165 -
> fopen(Zend/Dojo/View/Helper/HeadTitle.php) [<a
> href='function.fopen'>function.fopen</a>]: failed to open stream: No
> such file or directory
> Debug Warning: /domain.com/library/Zend/Loader.php line 165 -
> fopen(/www/vhosts/local.domain.com/application/views/helpers/HeadTitle.php)
> [<a href='function.fopen'>function.fopen</a>]: failed to open stream:
> No such file or directory
> Debug Warning: /domain.com/library/Zend/Loader.php line 165 -

http://www.nabble.com/view-helpers-broken-td22345239.html#a22351992

Chris


Paddy Lock wrote:
Thanks, but the problem is not that I can't use the custom view helpers, it's that I get all the warnings about the Zend view helpers apparently not loading such as  Warning: Zend_Loader_PluginLoader::include_once(View/Helper/Doctype.php) [function.Zend-Loader-PluginLoader-include-once]: failed to open stream: No such file or directory in C:\home\system\www\Patrick Lock Limited\Workspace\Patrick Lock Limited\library\Zend\Loader\PluginLoader.php on line 372  Although everything is loading fine on the page. I just want to know why I get these warnings?  thanks Paddy    sayusi wrote:   
2009/7/22 Paddy Lock <patrick.lock@gmail.com>:     
Hi, I am trying to implement custom view helpers but nothing seems to work.  This is what I have in my bootstrap class  protected function _initViewDoctype()    {            $this->bootstrap('view');            $view = $this->getResource('view');            $view->addHelperPath('View/Helper', 'View_Helper'); //Change as per your path and class            $view->setEncoding('UTF-8');            $view->doctype('XHTML1_STRICT');     }  my helper class is called View_Helper_StripSpecialChar and sits in application/lib/View/Helper  In my controller I can call the view helper function like this  $test = $this->view->stripSpecialChar("test's");       
Maybe, you should try it with absolute path.  András  --  - - --  Csanyi Andras  -- http://sayusi.hu -- Sayusi Ando --  "Bízzál Istenben és tartsd szárazon a puskaport!".-- Cromwell       
   

没有评论: