On Wed, Dec 5, 2012 at 8:21 AM, Javier Garcia <tirengar...@gmail.com> wrote: > I trying to add javascript code to my view so i followed this > <http://www.stoimen.com/blog/2010/06/24/zend-framework-inject-javascript-code-in-a-actionview/> > tutorial and I added this below to my controller: > > |$scripts= $this->view->inlineScript(); > $scripts->appendScript('alert("jfkasd")');| > > But i there is either no alert pop up nor I find any reference to |alert()| > function in the source code of the page.
inlineScript(), and the other placeholders, *aggregate* information. Typically, the intent is to aggregate information from a variety of view scripts that you then want to render in your _layout_ _template_. As such, in your layout view script, you need to have a line like the following: echo $this->inlineScript(); If you never do that, then the aggregated scripts will never be rendered. > Since I don't know exactly if I write those lines in the action or the view, > I also tried this: > > |<!-- /views/scripts/contracts/generalinfo.phtml --> > <?php $scripts= $this->inlineScript() ?> > <?php $scripts->appendScript('alert("jfkasd")') ?>| > > but the result is the same as before.. -- Matthew Weier O'Phinney Project Lead | matt...@zend.com Zend Framework | http://framework.zend.com/ PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc -- List: fw-general@lists.zend.com Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscr...@lists.zend.com