This can be done using PHP and defining the constants when you include the file, if you always load them only in PHP or, possibly, in javascript.
This may work as a PHP solution:
function checkJSLoad($var){ if(!defined($var)){ define($var, 1); return false; } else { return true; } } function javascriptLoad($location, $defined = ''){ if(!$defined) { $defined = 'JS_' . $location; } if( !checkJSLoad($defined) ){ return '<script type="text/javascript" src="'.$location.'"></script>'; } }
Then you can simply call it like this: javascript_load ('/jquery.js', 'jquery'); which will output the correct tag for the js file.
You can do something similar with css, maybe
Joel
source share