I need to add jQuery and other javascript files to my Zend Framework project. I am trying to do it with an Action controller:-
public function userinfoAction() {
Probably the easiest way to use view helpers from within a controller in ZF2 is via the renderer object:
public function someAction() { $renderer = $this->serviceLocator->get('Zend\View\Renderer\RendererInterface'); $renderer->headScript()->appendFile($renderer->baseUrl() . '/js/somejs.js'); }