sushantkaura Posted November 11, 2007 Share Posted November 11, 2007 hey guys , i m new to php , so having a little trouble, plz help me out i m using a player to play songs whose statement is written in JAVA SCRIPT which is in my player.php <script type="text/javascript"> var so = new SWFObject("playerSingle.swf", "mymovie", "192", "67", "7", "#FFFFFF"); so.addVariable("autoPlay", "yes"); *so.addVariable("soundPath", "song.mp3"); so.write("flashPlayer"); </script> i want to place a different url which is in my variable $url,in php rather than song.mp3 plz tell me how to do it... thnx in advance..................... sushant kaura Quote Link to comment Share on other sites More sharing options...
atlanta Posted November 11, 2007 Share Posted November 11, 2007 hey guys , i m new to php , so having a little trouble, please help me out i m using a player to play songs whose statement is written in JAVA SCRIPT which is in my player.php <script type="text/javascript"> var so = new SWFObject("playerSingle.swf", "mymovie", "192", "67", "7", "#FFFFFF"); so.addVariable("autoPlay", "yes"); *so.addVariable("soundPath", "song.mp3"); so.write("flashPlayer"); </script> i want to place a different url which is in my variable $url,in php rather than song.mp3 please tell me how to do it... thnx in advance..................... sushant kaura <script type="text/javascript"> var so = new SWFObject("playerSingle.swf", "mymovie", "192", "67", "7", "#FFFFFF"); so.addVariable("autoPlay", "yes"); *so.addVariable("soundPath", "<?=$url?>"); so.write("flashPlayer"); </script> Quote Link to comment Share on other sites More sharing options...
sushantkaura Posted November 11, 2007 Author Share Posted November 11, 2007 hey man, its showin this error.. wht to do . am i m doin something wrong? ??? "Parse error: syntax error, unexpected '=' in" Quote Link to comment Share on other sites More sharing options...
atlanta Posted November 11, 2007 Share Posted November 11, 2007 whats the webpages url? heres an example. <?php $url = "test.mp3"; ?> <script type="text/javascript"> var so = new SWFObject("playerSingle.swf", "mymovie", "192", "67", "7", "#FFFFFF"); so.addVariable("autoPlay", "yes"); so.addVariable("soundPath", "<?=$url?>"); so.write("flashPlayer"); </script> Quote Link to comment Share on other sites More sharing options...
sushantkaura Posted November 11, 2007 Author Share Posted November 11, 2007 actually the the songs are on my computer , in $url i have given the path of the song, which path i have stored in my database and i have echoed it and its giving the rite path . if i m giving space between <? and = , its not loading the player and if i dont leave a space than it show the previous error Quote Link to comment Share on other sites More sharing options...
atlanta Posted November 11, 2007 Share Posted November 11, 2007 shoe me all of your code please Quote Link to comment Share on other sites More sharing options...
FireDrake Posted November 11, 2007 Share Posted November 11, 2007 uhm do <?php $url ?> instead of only <? $url ?> maybe that works at least that was one of my problems some time ago, if that wont work, what is the error? Quote Link to comment Share on other sites More sharing options...
sushantkaura Posted November 11, 2007 Author Share Posted November 11, 2007 here is the code , shold i send u the java script and the player.swf in this code the session is used for the url from the earlier page. song.mp3 is stored in the same dir. <?php session_start(); ?> <html > <head> <title>Player</title> </head> <body> <?php //echo "url is".$_SESSION['url']; //$url=$_SESSION['url']; $url="song.mp3"; ?> <script type="text/javascript" src="swfobject.js"></script> <div id="flashPlayer"> This text will be replaced by the flash music player. </div> <script type="text/javascript"> var so = new SWFObject("playerSingle.swf", "mymovie", "192", "67", "7", "#FFFFFF"); so.addVariable("autoPlay", "yes"); so.addVariable("soundPath", "<?=$url?>"); so.write("flashPlayer"); </script> <p> </p> </body> </html> Quote Link to comment Share on other sites More sharing options...
sushantkaura Posted November 11, 2007 Author Share Posted November 11, 2007 if i m doin <?php $url ?> thn its loading my player but not playing the song and above tht i have set $url="song.mp3"; but its not playing . but whn i only put simple song.mp3 in tht place its simply palying it ..... do u have any idea .. i have downloaded tht player from net .. its playing fine if i m giving any path but whni give php url , its not playing ... can u help me out on this.. Quote Link to comment Share on other sites More sharing options...
atlanta Posted November 11, 2007 Share Posted November 11, 2007 you dont wanna do <?php $url ?> <?php session_start(); ?> <html > <head> <title>Player</title> </head> <body> <?php //echo "url is".$_SESSION['url']; //$url=$_SESSION['url']; $url="song.mp3"; ?> <script type="text/javascript" src="swfobject.js"></script> <div id="flashPlayer"> This text will be replaced by the flash music player. </div> <script type="text/javascript"> var so = new SWFObject("playerSingle.swf", "mymovie", "192", "67", "7", "#FFFFFF"); so.addVariable("autoPlay", "yes"); so.addVariable("soundPath", "<?=$url?>"); so.write("flashPlayer"); </script> <p> </p> </body> </html> Make sure that song.mp3 and playerSingle.swf is in the same folder as this webpage for this to work Quote Link to comment Share on other sites More sharing options...
sushantkaura Posted November 11, 2007 Author Share Posted November 11, 2007 thnx man , it works....... thnx once again to all , who listened to me... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.