2
基本上我會喜歡用dojo佈局一個網站,我將有一個標題,內容區域(這是分成兩部分在左窗格中的一些手風琴和右主要內容),然後是頁腳。需要幫助鋪設一個網站與dojo
因爲我需要網站總是有這個佈局我決定把它放在主佈局。然而,當我查看網站時,我看到默認索引頁面正常,但它不在窗格中,因爲我希望沒有任何dijit小部件被渲染。
不確定是否允許在帖子中粘貼大型代碼,如果不是,我很抱歉,但下面是主佈局的代碼。我對默認的zend工具結構沒有太多的瞭解。我只創建了幾個模塊:
<?php
Zend_Dojo::enableView($this);
$this->dojo()->setCdnBase(Zend_Dojo::CDN_BASE_GOOGLE)
->addStyleSheetModule('dijit.themes.tundra')
->setDjConfigOption('parseOnload', TRUE)
->setDjConfigOption('locale', 'en-GB')
->setDjConfigOption('isDebug', TRUE);
echo $this->dojo();
?>
<script type="text/javascript">
dojo.require("dijit.layout.ContentPane");
dojo.require("dijit.layout.BorderContainer");
dojo.require("dijit.layout.TabContainer");
dojo.require("dijit.layout.AccordionContainer");
</script>
</head>
<body>
<div dojoType="dijit.layout.BorderContainer" gutters="true" id="borderContainer">
<div id="header" dojoType="dijit.layout.ContentPane" region="top" splitter="false">
<div id="logo">
<img src="/images/logo.gif" />
</div>
<div id="menu">
<a href="<?php echo $this->url(array(), 'home'); ?>">HOME</a>
<a href="<?php echo $this->url(array('page' => 'services'), 'static-content'); ?>">SERVICES</a>
<a href="#">CONTACT</a>
</div>
</div><!-- end header -->
<div dojoType="dijit.layout.BorderContainer" liveSplitters="false" design="sidebar"
region="center" id="content">
<div dojoType="dijit.layout.AccordionContainer" minSize="20" style="width: 300px;"
id="leftAccordion" region="leading" splitter="true">
<div dojoType="dijit.layout.AccordionPane" title="One fancy Pane">
</div>
<div dojoType="dijit.layout.AccordionPane" title="Another one">
</div>
<div dojoType="dijit.layout.AccordionPane" title="Even more fancy" selected="true">
</div>
<div dojoType="dijit.layout.AccordionPane" title="Last, but not least">
</div> <!-- end AccordionContainer -->
</div>
<div dojoType="dijit.layout.TabContainer" region="center" tabStrip="true">
<div dojoType="dijit.layout.ContentPane" title="My first tab" selected="true">
<?php echo $this->layout()->content ?>
</div>
<div dojoType="dijit.layout.ContentPane" title="My second tab">
Lorem ipsum and all around - second...
</div>
<div dojoType="dijit.layout.ContentPane" title="My last tab" closable="true">
Lorem ipsum and all around - last...
</div>
</div>
</div>
<div id="footer">
<p>Created with <a href="http://framework.zend.com/">Zend Framework</a>. Licensed under <a href="http://www.creativecommons.org/">Creative Commons</a>.</p>
</div><!-- end footer -->
</div>
請注意,您可能不需要爲了您的目的而嵌套兩個BorderContainer;一個頂部/左/底部/中心區域應該是足夠的。看看這個「更高級的例子」:http://dojotoolkit.org/reference-guide/dijit/layout/BorderContainer.html#more-advanced-example另外,你缺少`class =「tundra」`在你的身體標籤上實際應用主題。 – 2011-01-25 00:00:15