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()
{
Here is how you can use view helpers from within a controller in ZF2 to solve your problem:
public function someAction()
{
$this->getViewHelper('HeadScript')->appendFile($basePath . '/js/somejs.js');
}
protected function getViewHelper($helperName)
{
return $this->getServiceLocator()->get('viewhelpermanager')->get($helperName);
}