[thelist] parse file.js with PHP

ramon buckland ramon at thebuckland.com
Thu Jun 27 10:01:08 CDT 2002


> > Hi all,
> > I need to parse a file.js file with PHP. Should I:
> > - call it file.php? (easiest, but can I do that?)
> > - change the settings in an .htaccess file? (how was that again? what did
> I
>
> Calling it file.php is probably a bad idea, because some browsers may want
> it to be served as text/javascript or whatever, which could cause issues.
>

We had a similar thing with cold fusion, I got around those issues by doing
this

----------somefile.cfm----------
<script language="Javascript">
<!--
	<cfinclude template="../js/contents_js.cfm">
//-->
</script>
----------somefile.cfm----------

So .. that way, the file was parsed by Coldfusion, the client(browser) never
saw a _js.cfm file in the <script src="..."> and
we also notewd (by the _js) that it was JavaScript

my 2cents * make it a tip *
- ramon




More information about the thelist mailing list