-- Ralikwen <balazs.kl...@gmail.com> wrote (on Wednesday, 28 October 2009, 06:31 AM -0700): > I am generating javascript code for form elements in custom decorators. > As opposed to normal decorator functionality the generated code should not > go within the form but to the final view rendered.
I'd capture that content in a placeholder, and then render the placeholder in your layout or view script: http://framework.zend.com/manual/en/zend.view.helpers.html#zend.view.helpers.initial.placeholder > This is how I am outputting this in the view script: > <? if (!empty($this->ExtOnReady)) { > echo <<<HEREDOC > <link href='/scripts/ext-3.0.0/resources/css/ext-all.css' media='screen' > rel='stylesheet' type='text/css' /> > <script type='text/javascript' > src='/scripts/ext-3.0.0/adapter/ext/ext-base.js'></script> > <script type='text/javascript' src='/scripts/ext-3.0.0/ext-all.js'></script> > <script type='text/javascript'> > Ext.onReady(function(){ > Ext.QuickTips.init(); > $this->ExtOnReady > }); > </script> > HEREDOC; > }?> > > This is what I am doing in the decorator: > public function render($content) { > $element = $this->getElement (); > $view = $element->getView (); > ....... > ....... > $view->ExtOnReady = $view->ExtOnReady . "new Ext.ToolTip({ > title: '$label', > target: '$name-ttarget', > anchor: 'left', > trackMouse: true, > html: '$description' > });"; > ...... > ...... > > When I call this from one of my module $view->ExtOnReady has a value after > $form->setConfig ( $config ); > is executed, when I call this from another it doesn't. > In both cases if I dump $view->ExtOnReady from within the decorator it does > have value, but in one case somehow it mysteriously disappears. > I also tried putting the jscript into the registry but even that claims to > be unset. > I don't even know how to debug the code that runs between the decorator > (where I do have the value) and the return of the form object (where I > don't). > > Any idea what I might be doing wrong or how to do this correctly/reliably? > Thanks for the help. > > SWK > > > -- > View this message in context: > http://www.nabble.com/passing-values-to-view-from-decorators-tp26094673p26094673.html > Sent from the Zend Framework mailing list archive at Nabble.com. > -- Matthew Weier O'Phinney Project Lead | matt...@zend.com Zend Framework | http://framework.zend.com/