Including Javascript within web pages
<p>Can anyone please recommend the best and easiest way to include multiple Javascript files on a (PHP based) web page?</p>

<p>I have a website that uses jQuery, and anything up to around 10 plugins on any one particular page. I'm not entirely sure of the best way to go about including all these files to make life simple for me as a dev, and to ensure that they are best served to a user.</p>

<p>Ideally I thought the easiest way myself would be to build a PHP handler file that I could use to call which plugins I reqire for each page, and then have it output javascript that used document.write() to 'include' each plugin JS file on the page, like so:</p>

<pre><code>&lt;script src="handler.php?jquery,plugin1,plugin2,plugin3,plugin4"&gt;&lt;/script&gt;
</code></pre>

<p>which might then output Javascript with multiple document.write()'s to each individual plugin.</p>

<p>I am led to believe this might lead to problems with browser caching however, as some browsers ignore caching of items with query strings.</p>

<p>Is this OK to do, or is there a simpler method that I'm perhaps missing?</p>
