[thelist] External Javascript files + PHP

Poojie poojie at dccnet.com
Thu Oct 25 03:34:32 CDT 2001


----- Original Message ----- 
From: "Andrew Forsberg" <andrew at thepander.co.nz>

> Maybe I'm doing something entirely too stupid, but, I can't seem to 
> get a external javascript file, linked via the src="foobar.php" 
> attribute of a <script> tag, to work when there's php code in the 
> external javascript file. 


Make sure there are no spaces before the <? or after the ?> 
in foobar.php, this will force the Content-type to be text/html.
Also be sure that the header is printed before any other output 
from the script. Another possible solution would be to use output
buffering: http://www.php.net/manual/en/function.ob-start.php


Daryl





More information about the thelist mailing list