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


when I used


to change to another layout, and then I use


to append script, the $script render twice like

please check it out


A fix to prevent duplicate output.

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

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

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.