I have a php variable which uses some preset functions from a CMS to give me a file location on a server.

What I need to be able to do is use this variable within my external javascript file. I'm ok with javascript, fine with php but combining the two is giving me a bit of a headache.

I've read I can simply have my script.js file as script.php and have javascript then in it, but this doesn't ever seem to work for me and the js gets ignored?

Any help would be great,