2009年10月14日星期三

Re: [fw-mvc] View helper HeadScript

Hi all,
The view helper has a property $view so inside view helpers extending Zend_View_Helper_Abstract you should do $this->view->helper('something');


But Ed, I think you're having the problem because the view helper headScript() is used first and then you're adding some more files. It's something which isn't clear from your mail, but it might be the problem (I have dealt with that mistake many times ;) ).


Regards, Jurian


--
Jurian Sluiman
Soflomo.com


Op Wednesday 14 October 2009 05:42:20 schreef Duo Zheng:
> Ed,
> View helpers shouldn't have an instance of $this->view no? Shouldn't it be
>
> $this->headScript()->appendFile('/js/test.js', 'text/javascript');
>
> ?
>
> On Tue, Oct 13, 2009 at 6:44 PM, Ed Lazor <edlazor@internetarchitects.biz>wrote:
> > Any idea why this isn't working from within a view helper that extends
> > Zend_View_Helper_Abstract?
> >
> > $this->view->HeadScript()->appendFile('/js/test.js',
> > 'text/javascript');
> >
> > It works if I move the line to the controller action.
> >
> > -Ed

没有评论: