I've been doing some more reading. It seems that this is similar to what is described here: http://framework.zend.com/issues/browse/ZF-3282 . Should I add my observations to this issue or are they not related?
---- Jeremy Brown Senior Web Developer Spear One 972.661.6038 www.spearone.com<http://www.spearone.com> From: Jeremy Brown [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 19, 2008 12:00 PM To: [email protected] Subject: [fw-general] Dojo View Helper Question Here is a "manipulated" version of my layout file (in other words, I have replaced some PHP code with hard-coded values in order to shorten its length): <html> <head> <?= $this->headTitle() . "\n"; ?> <?= $this->headMeta() . "\n"; ?> <?= $this->headLink() . "\n"; ?> <?= $this->headStyle() . "\n"; ?> <? if ( $this->dojo()->isEnabled() ): $this->dojo()->setCdnBase( Zend_Dojo::CDN_BASE_GOOGLE ) ->setCdnDojoPath( Zend_Dojo::CDN_DOJO_PATH_GOOGLE ) ->addStyleSheetModule( 'dijit.themes.tundra' ) ->useCdn(); echo $this->dojo() . "\n"; endif; ?> <?= $this->headScript() . "\n"; ?> </head> <body class="tundra"> <div id="main"> <div> <form> <select name="setQuarterID" onChange="updateQuarterID()"/> <option value="2">2008: Quarter 3</option> <option value="3">2008: Quarter 4</option> </select> </form> <? $this->dojo()->enable() ->requireModule( 'dojo.rpc.JsonService' ); $this->headScript()->captureStart(); ?> function updateQuarterID() { var jsonQuarterSelect = new dojo.rpc.JsonService( '/manage/json/environment' ); console.log( jsonQuarterSelect.setQuarterID() ); } <? $this->headScript()->captureEnd() ?> </div> <div id="content"> <?= $this->layout()->content ?> </div> </div> </body> </html> If I call the following from any of the view scripts associated with controllers, then the expected Dojo-related code is placed in/near the header of my document: <? $this->dojo()->enable() ->requireModule( 'dojo.rpc.JsonService' ); $this->headScript()->captureStart(); ?> function demoRpc() { var myObject = new dojo.rpc.JsonService( 'manage/json/environment' ); console.log( myObject.setQuarterID() ); } <? $this->headScript()->captureEnd() ?> However, if I place the same code WITHIN the actual layout file itself, so that it is above the <?= $this->layout()->content ?> call let's say, and I remove it from the aforementioned view script (so won't be called/rendered twice), then the expected Dojo-related code is not displayed in/near the head. Maybe I'm not understanding how all of the pieces are being rendered and in what order they are, but shouldn't I be able to call this from the layout itself? How does this differ from a view in that aren't they "put back together" at the end? Regards ---- Jeremy Brown Senior Web Developer Spear One 972.661.6038 www.spearone.com<http://www.spearone.com>
