ZF-5629: headScript()->appendScript() render twice when layout->setLayout
Description
when I used
$this->_helper->layout->setLayout('no_header_footer');
to change to another layout, and then I use
$this->headScript()->appendScript($script);
to append script, the $script render twice like
please check it out
Comments
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.: <?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'); ?>
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.