I’m upgrading a CakePHP application from 1.3 to 2.9.
I’m trying to append scripts to the bottom of my page.
Is this how the afterRender function is supposed to work in cake 2?
I’m now using script blocks to output the scripts to the bottom of my page, which works. But unfortunately I can’t append anything to this block after the page has been output. So when I call a function to render an input field from my extendedformhelper, the afterRender function does get called but no scripts get added to the page.
Is there a new/better way of doing this?
TL;DR: how to append script tags to bottom of page after a view (including elements) has been rendered?
This is the code that I’m currently using in the afterRender function:
$this->Html->scriptBlock($afterRenderScripts, array(‘block’ => ‘afterRenderScripts’, ‘inline’ => false));