Handling page-specific JavaScript in PHP header files
<p>When designing a website in PHP, you typically have a <code>header.php</code> file that you include in every page on the site. The <code>header.php</code> file would include the <code>&lt;head&gt;</code> tag (among other things). However, I often find that I need to put page-specific JavaScript within the <code>&lt;head&gt;</code> tag.</p>

<p>The way I've handled this in the past is by adding IF statements to my header to determine what pieces of JavaScript should be outputted (i.e. IF this is the <em>home</em> page, output the JavaScript needed for the <em>home</em> page, IF this is the <em>about</em> page, output the JavaScript needed for the <em>about</em> page, etc.).</p>

<p>This is probably a terrible way to do it. What is the standard practice?</p>
