Skip to content

Instantly share code, notes, and snippets.

@AV4TAr
Created August 3, 2011 15:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AV4TAr/1122844 to your computer and use it in GitHub Desktop.
Save AV4TAr/1122844 to your computer and use it in GitHub Desktop.
Javascript Helper Zend Framework MVC
<?php
class Zend_View_Helper_JavascriptHelper extends Zend_View_Helper_Abstract
{
function javascriptHelper() {
$request = Zend_Controller_Front::getInstance()->getRequest();
$file_uri = 'js/' . $request->getControllerName() . '/' . $request->getActionName() . '.js';
if (file_exists($file_uri)) {
$this->view->headScript()->appendFile('/' . $file_uri);
}
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment