Its possible but I wouldn't recommend it. If, down the line, you want to add an actually .js file you'd have to either A) change the file extension or B) add another handler. The quickest way to do this is have all your Javascript in a PHP file then at the top of the file define the content type:
<?php header("Content-type: text/javascript"); ?>
function someJavascriptFunction(){
js1 = <?php echo $blah ?>;
}
There's nothing saying a script source MUST be .js
<script type="text/javascript" src="someJS.php"></script>
ShawnCplus
Code Monkey
1,583 posts since Apr 2005
Reputation Points: 526
Solved Threads: 268