2008年11月24日星期一

Re: [fw-mvc] View helpers bug ?

-- Prout Prout <smallgeek@hotmail.fr> wrote
(on Monday, 24 November 2008, 06:13 PM +0200):
> Is there a reason why javascript doesn't show up in a view helper ?
>
> I posted a view helper problem last week and worked on it without success after
> extended researchs. I'm starting to think it's a bug more than anything else.
>
> 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.

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

>
> // 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.

> (...)
>
>
> <?php
>
> }
>
> }
> ?>

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

没有评论: