2008年9月29日星期一

Re: [fw-mvc] dojo and helper: no such file or directory

-- Alessandro Camilli <alex_cam@libero.it> wrote
(on Monday, 29 September 2008, 07:31 AM -0700):
> i'm trying to use Zend_Dojo_Form but I have a problem with the view scripts.
> I hope sameone can help me.
> This is my code
>
> In my bootstrap.php
> ----------------------------
> //* LAYOUT
> $layout = Zend_Layout::startMvc(array(
> 'layoutPath' => APPLICATION_DIRECTORY .'/layouts'
> ,'layout' => 'main'
> ));
> //* DOJO
> $layout->getView()->addHelperPath('Zend/Dojo/View/Helper/',
> 'Zend_Dojo_View_Helper');

First, let's simplify the above line:

Zend_Dojo::enableView($layout->getView());

> -----------------------------
>
> In the script of layout main.phtml
> ---------------------------------------
>
> <head>
> ...(OMIT)
> if ($this->dojo()->isEnabled()):
> // Include dojo library
> $this->dojo()->setLocalPath(BASE_URL.'js/dojo/dojo/dojo.js')
> // Use dojo theme tundra
> ->addStyleSheetModule('dijit.themes.tundra');
> // Echo out the dojo <script> tags
> echo $this->dojo();
> endif;
> ...(OMIT)
>
> With the debug, when is performing the "echo $this->dojo()", I have this
> debug warning:
> " ..\Zend\Loader.php line 160 - fopen(Zend/Dojo/View/Helper/DocType.php) :
> failed to open stream: No such file or directory

Two things. First, warnings are not fatal. In this case, it was trying
to find a given helper -- the doctype helper -- and didn't find it on
the first view helper path searched.

Second, the issue you have is not from the line you claim it is. It's
actually from a line you're not displaying in your layout script, the
one that reads:

<?= $this->docType() ?>

The problem is with the letter case you used -- it should be
"doctype()", not "docType()" (the actual view helper class is
Zend_View_Helper_Doctype).

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

没有评论: