Suppose I am using an MVC framework, and my views require Javascript files located in a file external to the view. My javascript located in the external file depends, however, upon a few PHP variables in my view. If I were to include the Javascript in a tag inside my HTML view, I could simply inject the PHP variables into the Javascript.
I know I can create hidden input fields and assign the variables I need as their values. Is there another, more elegant way?
I know I could probably get away with naming the .js file to .php, but I'm not too fond of doing that.