2008年11月30日星期日

Re: [fw-mvc] View helpers bug ?

Zend_View_Helper_Partial uses a cloned version of the view object which is destroyed after the partial is rendered.  This makes the layout helper useless in partials because the view has a private scope.  

Michael DePetrillo
theman@michaeldepetrillo.com
Mobile: (858) 761-1605


On Fri, Nov 28, 2008 at 11:14 AM, Zladivliba Voskuy <nospampam@hotmail.fr> wrote:
Thanks Matthew for your replies, but I really think this is a view helper bug.


> > Here's what's not working :
> > class Zend_View_Helper_Loginbox extends Zend_View_Helper_Partial{
> > public function loginbox() {
> > // this doesn't work, the file never gets included
> > $this->view->headScript()->appendFile('/scripts/js/myfile.js');
>
> What version of ZF are you using? I *believe* the issue with
> placeholders being populated from partials was fixed for either 1.6.0 or
> 1.7.0.

I used 1.6.0 I updated to 1.7.0 after your message, I have the exact same error.


> You *do* know that you have to echo the headScript() view helper from
> your layout file, right?

"echo $this->headScript(); " is what I use on my layout file.
Now as far as I remember I've been using this piece of code of my application, it works fine, except when I use it in a view helper ; this is the reason I'm re-posting this.


> > // neigher the content of my javascript function after this !!!
> > $this->view->dojo()->javascriptCaptureStart();
> > ?>
> >
> > dojo.addOnLoad(function(){
> > alert("it s not working");
> > });
> >
> > <? $this->view->dojo()->javascriptCaptureEnd(); ?>
>
> Same goes for the dojo() view helper -- you have to echo it from your
> layout file.

echo $this->dojo(); is what I have on my layout file. Now everything piece of dojo code I have on my application works fine, except when I put it on a view helper.

Is there anywhere else I can try to look to solve this thing ?



Appelez vos amis de PC à PC -- C'EST GRATUIT Téléchargez Messenger, c'est gratuit !

没有评论: