Re: Javascript & PHP...

From: Date: Tue, 05 Sep 2000 14:03:46 +0000
Subject: Re: Javascript & PHP...
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-2419@lists.php.net to get a copy of this message
Mikey wrote: > I want to pass PHP values into an external JavaScript source file. I am > guessing that all I need to do is add .js to the to the list of AddType > directives, however, is there anyone who has tried to do this before an can > share a little wisdom before I go too far down this road... Mikey, Not sure if this is EXACTLY what you're looking for, but I do something similar w/ PHP4. Basically, I don't pass php values out to the javascript source, BUT I have my php-script output valid javascript back to the browser... Instead of returning a full set of HTML headers, body, etc., I simply return a bunch of document.write() tags and function code (if that's what would normally be in the .js file) I make my php script output look exactly like the relevant Javascript source file. Then, when including this php-script in plain HTML pages, I simply add the line (just like regular javascript client-side includes): <script language="Javascript" src="myscriptgenerator.php3"></script> To the browser, the php script result looks EXACTLY like a pre-existing javascript sourcefile, but on the server-end, this source is dynamically generated. Hope that helps a bit. -- Andy Hoffman Web Developer Bristol-Myers Squibb email: andy.hoffman@bms.com

« previous php.windows (#2419) next »