2008年12月2日星期二

Re: [fw-mvc] Zend Dojo don't work

Have used this code on layout index:

<? $content = $this->render('body.phtml');

?>

<html>
<head>

<? $this->dojo()->enable;?>
<?= $this->dojo();?>


</head>

<body class="tundra">

<?= $content ?>

</body>
and have add to body.phtml a style to masterLayout id:
$this->borderContainer()->captureStart('masterLayout',
array('design' => 'headline'),array(
'style' => 'width: 100%; height: 100%',
));
now the browser print the content of div but without the style of tundra
theme...


Matthew Weier O'Phinney-3 wrote:
>
> -- angelbit <angelbit88@gmail.com> wrote
> (on Monday, 01 December 2008, 11:38 PM -0800):
>> Have used this code for enable the dojo view helper in my own plugin(use
>> Zend Layout):
>>
>>
>> $view=$layout->getView();
>> Zend_Dojo::enableview($view);
>> $view->dojo()->addStylesheetModule('dijit.themes.tundra')
>> ->setLocalPath('/lib/dojo/dojo/dojo.js');
>>
>> and have insert this code in my view template file:
>>
>> <?= $this->doctype() ?>
>> <html>
>> <head>
>> <? $this->dojo()->enable;?>
>> <?= $this->dojo();?>
>> </head>
>>
>> <body class="tundra">
>>
>>
>> <?
>> $this->borderContainer()->captureStart('masterLayout',
>> array('design' => 'headline'));
>> echo $this->contentPane(
>> 'menuPane',
>> 'This is the menu pane',
>> array('region' => 'top','parseOnLoad'=>true)
>> );
>
> You have two issues here.
>
> First, if you create dijits in your layout script, as you have done
> here, then they will not have a chance to populate the dojo() view
> helper before it has been echoed. You *must* render any dijits *prior*
> to echoing the dojo() view helper. You can accomplish this by moving
> these dijits to a separate view script, and rendering it to a variable
> at the top of your layout script:
>
> <? $content = $this->render('_layoutBody.phtml'); ?>
>
> Then simply:
>
> <?= $content ?>
>
> within the body of the layout script.
>
> Second, BorderContainer requires a STRICT doctype -- not a loose or
> transitional one. So, your choices are:
>
> $view->doctype('XHTML1_STRICT');
> $view->doctype('HTML4_STRICT');
>
> or simply not rendering the doctype at all.
>
>
>> echo $this->contentPane(
>> 'navPane',
>> 'This is the navigation pane',
>> array('region' => 'left','parseOnLoad'=>true)
>> );
>> echo $this->contentPane(
>> 'mainPane',
>> 'This is the main content pane area',
>> array('region' => 'center','parseOnLoad'=>true)
>> );
>> echo $this->contentPane(
>> 'statusPane',
>> 'Status area',
>> array('region' => 'bottom','parseOnLoad'=>true)
>> );
>> echo $this->borderContainer()->captureEnd('masterLayout');
>> ?>
>>
>> </body>
>>
>> </html>
>>
>> now this code print all the Dojo code but don't work.... (have a white
>> page):this is the the output from firefox:
>> (note: the css and js url's are exact)
>>
>> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
>> "http://www.w3.org/TR/html4/loose.dtd"><html>
>> <head>
>> <style type="text/css">
>> <!--
>> @import "/lib/dojo/dijit/themes/tundra/tundra.css";
>> -->
>> </style>
>>
>> <script type="text/javascript" src="/lib/dojo/dojo/dojo.js"></script>
>>
>> <script type="text/javascript">
>> //<!--
>> dojo.require("dijit.layout.ContentPane");
>> dojo.require("dijit.layout.BorderContainer");
>> dojo.require("dojo.parser");
>> dojo.addOnLoad(function() {
>> dojo.forEach(zendDijits, function(info) {
>> var n = dojo.byId(info.id);
>> if (null != n) {
>> dojo.attr(n, dojo.mixin({ id: info.id }, info.params));
>> }
>> });
>> dojo.parser.parse();
>> });
>> var zendDijits =
>> [{"id":"menuPane","params":{"region":"top","parseOnLoad":"true","dojoType":"dijit.layout.ContentPane"}},{"id":"navPane","params":{"region":"left","parseOnLoad":"true","dojoType":"dijit.layout.ContentPane"}},{"id":"mainPane","params":{"region":"center","parseOnLoad":"true","dojoType":"dijit.layout.ContentPane"}},{"id":"statusPane","params":{"region":"bottom","parseOnLoad":"true","dojoType":"dijit.layout.ContentPane"}},{"id":"masterLayout","params":{"design":"headline","dojoType":"dijit.layout.BorderContainer"}}];
>> //-->
>>
>> </script></head>
>>
>> <body class="tundra">
>>
>>
>>
>> <div id="masterLayout"><div id="menuPane">This is the menu pane</div>
>> <div id="navPane">This is the navigation pane</div>
>>
>> <div id="mainPane">This is the main content pane area</div>
>> <div id="statusPane">Status area</div>
>> </div>
>> </body>
>>
>> </html>
>>
>>
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Zend-Dojo-don%27t-work-tp20787446p20787446.html
>> Sent from the Zend MVC mailing list archive at Nabble.com.
>>
>
> --
> Matthew Weier O'Phinney
> Software Architect | matthew@zend.com
> Zend Framework | http://framework.zend.com/
>
>

--
View this message in context: http://www.nabble.com/Zend-Dojo-don%27t-work-tp20787446p20790949.html
Sent from the Zend MVC mailing list archive at Nabble.com.

没有评论: