2008年11月30日星期日

Re: [fw-mvc] View helpers bug ?

-- Michael Depetrillo <klassicd@gmail.com> wrote
(on Sunday, 30 November 2008, 12:35 AM -0800):
> 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.

This is not entirely true. The layout helper always references the same
layout object (singleton). Additionally, the various placeholder helpers
utilize a registry in order to persist. The fact that the view object is
not the same should not be an issue.

We've been working on solving this issue, and I thought we had it solved
for 1.7.0. If this is not the case, I'd like the OP to file a bug report
with reproduce code so we can figure it out.


> 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 !
>
>

--
Matthew Weier O'Phinney
Software Architect | matthew@zend.com
Zend Framework | http://framework.zend.com/

没有评论: