How to Use PHP for External JavaScript Files
- 1). Open the HTML page in your default text editor.
- 2). Click to place your cursor between the "<head>" and "</head>" tags. Then press "Enter" to create a blank line.
- 3). Type "<script type="text/javascript" src="[URL]/[filename]"></script>" on the blank line.
- 4). Replace the "[URL]" and "[filename]" text in the previous step with the URL and name of the external PHP file. For example, if the PHP file is called "script.php" and located at "http://www.example.com/scripts/", type "<script type="text/javascript" src="http://www.example.com/scripts/script.php"></script>" on the blank line.
- 5). Click "File" and "Save" to save the HTML page.
Source...