ZF-5629: headScript()->appendScript() render twice when layout->setLayout

Issue Type: Bug Created: 2009-01-24T20:52:10.000+0000 Last Updated: 2010-11-18T08:11:53.000+0000 Status: Resolved Fix version(s): Reporter: Sam Wu (zjflyer) Assignee: Ryan Mauger (bittarman) Tags: - Zend_Layout

  • Zend_View

Related issues: Attachments: - library_Zend_View_Helper_HeadScript.php.patch


when I used


to change to another layout, and then I use


to append script, the $script render twice like

please check it out


Posted by Mark van der Velden (dynom) on 2009-03-10T08:09:19.000+0000

A fix to prevent duplicate output.

Posted by Mark van der Velden (dynom) on 2009-05-14T05:46:14.000+0000

The multiple rendering can be prevented by outputting the headSCript() call only once, e.g.: headScript()->appendFile('path/to/js1.js')->appendFile('path/to/js2.js'); ?>

And not: headScript()->appendFile('path/to/js1.js'); echo $this->headScript()->appendFile('path/to/js2.js'); ?>

Posted by Ryan Mauger (bittarman) on 2010-11-18T08:11:52.000+0000

This is not an issue, as noted in your comment, you are 'echoing' the view helper each time you are adding something. only echo the once, and this will not happen.

Have you found an issue?

See the Overview section for more details.


© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.