如何在将所有javascript文件加载到cake php中的页面之前将其附加到所有javascript文件中?

I need to append a variable to all Javascript files while they are included in a page automatically. The variable needs to be added before the page gets loaded.

Following is the example of what i need.

var scriptfile='http://www.whatever.com/myjs.js?rnd='+revision_number

I need to achieve this using Cake PHP.

I would extend the javascript helper, and write my own custom method to append the string, then call that new method in my layout.

Link, is the method you probably want to overwrite if you don't create a custom one. http://api.cakephp.org/class/javascript-helper#method-JavascriptHelperlink

If revision_number is something you have access to on the server side, you can also set a global variable in your layout and read from that in later scripting or in linked source files.