I have just started playing around with using Dojo in Zend Framework and things have been fine up until recently. For now, I would like to be able to make a simple GUI using BorderContainer and ContentPanes, however I have been finding this is a bit awkward.
Basically to get the container Dojo elements to work, I have found that I need to place them in a view script for Dojo to work. However to me, it would make sense that I can place some elements in my master layout file (layouts/scripts/default.phtml) as the individual view scripts should populate the panes rather than the whole page.
As an example this works, if I paste it into a view rendering a Dojo_Form as well:
<?php
$this->borderContainer()->captureStart('main-container',
array('design' => 'headline'),
array(
'style'=>'height:100%;width:100%',
'align' => 'left'
));
echo $this->contentPane(
'menuPane',
'This is the menu pane',
array('region' => 'top'),
array('style' => 'background-color: gray; color:white')
);
echo $this->contentPane(
'navPane',
'This is the navigation pane',
array('region' => 'left', 'splitter' => 'true'),
array('style' => 'width: 200px; background-color: lightgray;')
);
echo $this->contentPane(
'mainPane',
$this->form,
array('region' => 'center'),
array('style' => 'background-color: white;')
);
echo $this->contentPane(
'statusPane',
'Status area',
array('region' => 'bottom'),
array('style' => 'background-color: lightgray;')
);
echo $this->borderContainer()->captureEnd('main-container');
?>
But if I try to place any elements into the layout it stops working.
So, I'm pretty sure I know why this happens. I am presuming it's because by placing the dojo view helpers in the view scripts, the dojo elements are parsed before the layout script hits $this->dojo(). But, if I put the dojo elements into the layout script, then the elements are parsed after echoing $this->dojo().
I am interested to see what everyone else does to get around this problem?