-- Superbiji » <[EMAIL PROTECTED]> wrote
(on Friday, 05 December 2008, 11:40 AM +0700):
> Hi...
> I think i have problem using Zend Layout and Zend Dojo Container.. it
> only work when placing container codes in View Script but does not
> work in Layout.. for example I want to enclose
> $this->layout()->content with Content Pane..
I've explained how to do this several times on list. In your layout,
capture the content prior to rendering the dojo() view helper, and then
render the captured content:
<? $content = $this->contentPane(
'main', $this->layout()->content,
array('title' => 'Main content pane')
);
?>
<?= $this->doctype() ?>
<html>
<head>
<?= $this->headTitle() ?>
<?= $this->dojo() ?>
</head>
<body>
<?= $content ?>
</body>
</html>
An alternate solution is to capture all the dojo require statements into
a dojo layer:
public/
js/
custom/
main.js
dojo/
dojox/
dijit/
where main.js has contents like the following:
dojo.provide('custom.main');
(function() {
dojo.require("dijit.layout.ContentPane");
})();
and in your view setup, add that module and require:
$view = new Zend_View;
Zend_Dojo::enableView($view);
Zend_Dojo_View_Helper_Dojo::setUseDeclarative(true);
$view->dojo()->registerModulePath('custom', '../custom')
->requireModule('custom.main');
Doing the above will allow you to easily create a custom build later,
and gets around the chicken/egg problem when using layout scripts.
> 2008/11/26 Matthew Weier O'Phinney <[EMAIL PROTECTED]>:
> > -- Superbiji » <[EMAIL PROTECTED]> wrote
> > (on Wednesday, 26 November 2008, 04:21 PM +0700):
> >> Hi All..
> >> i've been trying zf 1.7 and add accordionContainer but without
> >> success..... please can anyone give me full examples? can't find it in
> >> manual yet.
> >>
> >> in my action:
> >> function dojoformAction() {
> >> Zend_Dojo::enableView($this->view);
> >>
> >> }
> >>
> >> view:
> >>
> >> <?= $this->dojo()->enable(); ?>
> >>
> >> </head>
> >> <body class=tundra>
> >>
> >>
> >> <?= $this->accordionContainer(
> >> 'foo',
> >> $content . "XXXXXXXXXX",
> >> array(
> >> 'duration' => 200,
> >> ),
> >> array(
> >> 'style' => 'width: 200px; height: 300px;',
> >> ) );
> >> ?>
> >
> > This is a classic mistake -- you're rendering the dojo() view helper
> > *before* any methods that would populate it have been called.
> >
> > The easy solution is to capture the content of your accordionContainer()
> > call *prior* to doing so, and then echo that content; I've done
> > similarly in the pastebin example application, only I do so by rendering
> > another view script.
> >
> > As an example, modify your layout script as follows:
> >
> > <? $container = $this->render('bodyAccordion.phtml'); ?>
> > <?= $this->doctype() ?>
> > <html>
> > <head>
> > ...
> > <?= $this->dojo() ?>
> > </head>
> > <body class="tundra">
> > <?= $container ?>
> > </body>
> > </html?
> >
> > and then, in bodyAccordion.phtml:
> >
> > <?
> > $this->dojo()->enable();
> > echo $this->accordionContainer(....);
> >
>
>
>
> --
> Kamus Online - http://kamus.landak.com/
>
--
Matthew Weier O'Phinney
Software Architect | [EMAIL PROTECTED]
Zend Framework | http://framework.zend.com/