title: Evaluating php generated javascript "inline"?
body: <p>If you look at the source of this page <a href="http://kingston.talking-newspapers.co.uk/" rel="nofollow noreferrer">http://kingston.talking-newspapers.co.uk/</a> you will see a large amount of inline javascript near the top.</p>
  
  <p>I don't really want all this extra stuff floating around in my page source, I'd much rather get it off into a script tag, and then I can minify it and all sorts.</p>
  
  <p>If I call it as a php file, this SHOULD work in theory, I just end the js file extension with php instead, and in the header I put the following:</p>
  
  <pre><code>header("Content-type:application/x-javascript");
  </code></pre>
  
  <p>but... a lot of the php variables used to generate the playlist within the javascript are setup at the beginning of the main index.php file, and in calling this php-generated js playlist file like this, it seems to evaluate it entirely separately, so it's full of errors.</p>
  
  <p>The only way round it I can think of is to have the page write a file, then immediately read it in. The other thing is, the playlist is likely to change often and dynamically, so I think I need to get minify to NOT cache it?</p>