我刚刚开始在Zend Framework中使用Dojo ,直到最近一切都很好。现在,我希望能够使用BorderContainer和ContentPanes制作一个简单的 GUI ,但是我发现这有点尴尬。
基本上,为了让容器 Dojo 元素工作,我发现我需要将它们放在视图脚本中,以便 Dojo 工作。但是对我来说,我可以在我的主布局文件 (layouts/scripts/default.phtml) 中放置一些元素是有意义的,因为单个视图脚本应该填充窗格而不是整个页面。
作为一个例子,如果我将它粘贴到渲染 Dojo_Form 的视图中:
<?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');
?>
但是,如果我尝试将任何元素放入布局中,它就会停止工作。
所以,我很确定我知道为什么会发生这种情况。我假设这是因为通过将 dojo 视图助手放在视图脚本中,dojo 元素在布局脚本命中$this->dojo()之前被解析。但是,如果我将 dojo 元素放入布局脚本中,则在回显$this->dojo()后会解析这些元素。
我有兴趣看看其他人如何解决这个问题?