2009年7月22日星期三

[fw-mvc] Add custom View Helpers

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");

This all works fine, however, I get lots of warnings 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

Warning: Zend_Loader_PluginLoader::include_once() [function.include]: Failed
opening 'View/Helper/Doctype.php' for inclusion
(include_path='C:\home\system\www\Patrick Lock Limited\Workspace\Patrick
Lock Limited\library;C:\home\system\www\Patrick Lock
Limited\Workspace\Patrick Lock Limited\application\lib;.') in
C:\home\system\www\Patrick Lock Limited\Workspace\Patrick Lock
Limited\library\Zend\Loader\PluginLoader.php on line 372
C:\home\system\www\Patrick Lock Limited\Workspace\Patrick Lock
Limited\application
Warning: Zend_Loader_PluginLoader::include_once(View/Helper/HeadLink.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

Warning: Zend_Loader_PluginLoader::include_once() [function.include]: Failed
opening 'View/Helper/HeadLink.php' for inclusion
(include_path='C:\home\system\www\Patrick Lock Limited\Workspace\Patrick
Lock Limited\library;C:\home\system\www\Patrick Lock
Limited\Workspace\Patrick Lock Limited\application\lib;.') in
C:\home\system\www\Patrick Lock Limited\Workspace\Patrick Lock
Limited\library\Zend\Loader\PluginLoader.php on line 372

Warning: Zend_Loader_PluginLoader::include_once(View/Helper/HeadScript.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

Warning: Zend_Loader_PluginLoader::include_once() [function.include]: Failed
opening 'View/Helper/HeadScript.php' for inclusion
(include_path='C:\home\system\www\Patrick Lock Limited\Workspace\Patrick
Lock Limited\library;C:\home\system\www\Patrick Lock
Limited\Workspace\Patrick Lock Limited\application\lib;.') in
C:\home\system\www\Patrick Lock Limited\Workspace\Patrick Lock
Limited\library\Zend\Loader\PluginLoader.php on line 372

Please can someone tell me why I am getting these warnings and how to get my
custom view helpers working correctly?

Thanks
Paddy
--
View this message in context: http://www.nabble.com/Add-custom-View-Helpers-tp24603245p24603245.html
Sent from the Zend MVC mailing list archive at Nabble.com.

没有评论: