I want to feed a php variable into a javascript code.
<?php
echo "<script type=\"text/javascript'>;\n";
echo "var so = new SWFObject(\"../../../../playerMultipleMenuPackage/;');\n";
echo $_GET['$products_id'];
echo "\"/playerMultipleList.swf\", \"mymovie\", \"295\", "\200\", \"7\", \"#FFFFFF\");\n";
echo "so.addVariable(\"autoPlay\",\"no\");\n"
echo "so.addVariable(\"playlistPath\",\"playlist.xml\");\n";
echo "so.write(\"flashPlayer\");\n";
echo "</script>;\n";
?>
What is incorrect
Writing Java with PHP
Moderator: General Moderators
- jayshields
- DevNet Resident
- Posts: 1912
- Joined: Mon Aug 22, 2005 12:11 pm
- Location: Leeds/Manchester, England
Re: Writing Java with PHP
For a start there are lots of mismatched quote marks.
-
freewill09
- Forum Newbie
- Posts: 5
- Joined: Tue Sep 08, 2009 5:00 pm
Re: Writing Java with PHP
I want the php to write this code:
<script type="text/javascript">
var so = new SWFObject("../../../../playerMultipleMenuPackage/php variable/playerMultipleList.swf", "mymovie", "295", "200", "7", "#FFFFFF");
so.addVariable("autoPlay","no")
so.addVariable("playlistPath","../../../../playerMultipleMenuPackage/playlist.xml")
so.write("flashPlayer");
</script>
<script type="text/javascript">
var so = new SWFObject("../../../../playerMultipleMenuPackage/php variable/playerMultipleList.swf", "mymovie", "295", "200", "7", "#FFFFFF");
so.addVariable("autoPlay","no")
so.addVariable("playlistPath","../../../../playerMultipleMenuPackage/playlist.xml")
so.write("flashPlayer");
</script>
Re: Writing Java with PHP
use a heredoc to clean that mess up my friend...
$js = <<<JS
<script type="text/javascript">
var so = new SWFObject("../../../../playerMultipleMenuPackage/php variable/playerMultipleList.swf", "mymovie", "295", "200", "7", "#FFFFFF");
so.addVariable("autoPlay","no")
so.addVariable("playlistPath","../../../../playerMultipleMenuPackage/playlist.xml")
so.write("flashPlayer");
</script>
JS;
echo $js;
Anything you need dynamic just replace with a variable...
$js = <<<JS
<script type="text/javascript">
var so = new SWFObject("../../../../playerMultipleMenuPackage/php variable/playerMultipleList.swf", "mymovie", "295", "200", "7", "#FFFFFF");
so.addVariable("autoPlay","no")
so.addVariable("playlistPath","../../../../playerMultipleMenuPackage/playlist.xml")
so.write("flashPlayer");
</script>
JS;
echo $js;
Anything you need dynamic just replace with a variable...
-
freewill09
- Forum Newbie
- Posts: 5
- Joined: Tue Sep 08, 2009 5:00 pm
Re: Writing Java with PHP
Thanks jayshields and ell0bo
did exactly what I needed to do
did exactly what I needed to do