2009年7月22日星期三

Re: [fw-mvc] Add custom View Helpers

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

没有评论: