如何在zf应用程序中集成zend_dojo

时间:2011-06-17 11:16:22

标签: zend-framework dojo

如何将一个手风琴小部件集成到helloworld zend项目中?这就是我到目前为止所得到的只是带有消息的页面。

自举:

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{

    protected function _initView()
    {
        $view = new Zend_View();
        //$view->addHelperPath('ZendX/JQuery/View/Helper/', 'ZendX_JQuery_View_Helper');

        $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();
        $viewRenderer->setView($view);
        Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
        $view->addHelperPath('Zend/Dojo/View/Helper/','Zend_Dojo_View_Helper');
        $view->dojo()->addStylesheetModule('dijit.themes.tundra');
    }
}

布局文件:

<?php echo $this->doctype() ?>

<html>
<head>

<?php echo $this->headTitle() ?>
<?php echo $this->headMeta() ?>
<?php echo $this->headLink() ?>
<?php echo $this->headStyle() ?>

<?php if ($this->dojo()->isEnabled()){

    $this->dojo()->setLocalPath('/js/dojo/dojo.js')
        ->addStyleSheetModule('dijit.themes.tundra');

    echo $this->dojo();
}
?>

<?php echo $this->headScript() ?>

</head>

<body class="tundra">

<?php echo $this->layout()->content ?>

<?php echo $this->inlineScript() ?>

</body>
</html>

查看:

<?php // setup required dojo elements:

$this->dojo()->enable()
          ->setDjConfigOption('parseOnLoad', true)

         ->requireModule("dijit.layout.AccordianContainer")
         ->requireModule("dijit.layout.ContentPane")?>   


<div style="width: 300px; height: 300px">
    <div dojoType="dijit.layout.AccordionContainer" style="height: 300px;">
        <div dojoType="dijit.layout.ContentPane" title="Heeh, this is a content pane">
            Hi!
        </div>
        <div dojoType="dijit.layout.ContentPane" title="This is as well" selected="true">
            Hi how are you?
        </div>
        <div dojoType="dijit.layout.ContentPane" title="This too">
            Hi how are you? .....Great, thx
        </div>
    </div>
</div>

0 个答案:

没有答案