Results 1 to 8 of 8

Thread: php and java

  1. #1
    Join Date
    Apr 2005
    Posts
    694

    php and java

    Hello all,

    I'm desperately need your expertise to help me end this project.

    Currently, I want php to output 4 javascript+some hex, but it's not working. Here's what I got so far:

    Code:
    <script type="text/javascript">
    		var FO = { movie:"/flashnews/moviestopmodule_1.0.0.swf", width:"635", height:"260", quality:"high", bgcolor:"#dddddd", wmode:"transparent", allowscriptaccess:"always", flashvars:"contentXML=%3C%3Fxml+version%3D%221.0%22+encoding%3D%22UTF-8%22%3F%3E%0A
    		
    		<? $pre_db = mysql_query("SELECT threadid,description,title,firstpostid FROM localhost_vbnews.thread WHERE forumid=12 AND attach=1 AND sticky=1 ORDER BY dateline DESC LIMIT 4") or die(mysql_error());  
      while($pre = mysql_fetch_array($pre_db)) {
      			$pre_info_db = mysql_query("SELECT title,pagetext FROM localhost_vbnews.post WHERE postid = $pre[firstpostid]") or die(mysql_error()); 
    	
    	while($pre_info = mysql_fetch_array($pre_info_db)) {
    	$attach2_db = mysql_query("SELECT attachmentid from localhost_vbnews.attachment WHERE postid = $pre[firstpostid] AND visible=1") or die(mysql_error()); 
    		
    			while($attach2 = mysql_fetch_array($attach2_db)) { 
    			$ptitle = bin2hex($pre[title]);
    			echo "	
    		%3Cpromo_slides%3E%0A++%3Cslide%3E%0A++++%3Cheadline%3E%26lt%3Bbr%26gt%3B$ptitle%3C%2Fheadline%3E%0A++++%3Csubhead%3EListen+to+localhost+%3C%2Fsubhead%3E%0A++++%3CtabText%3Elocalhost+Radio%3C%2FtabText%3E%0A++++%3CtabText2%3E24%2F7 +Live+Request%3C%2FtabText2%3E%0A++++%3CimageURL%3Ehttp%3A%2F%2Fwww.localhost.com%2Falex.jpg%3C%2FimageURL%3E%0A++++%3Clayout%3Evertical%3C%2Flayout%3E%0A++++%3CvideoURL%3Ehttp%3A%2F%2Fwww.localhost.com%2Fradio%3C%2FvideoURL%3E%0A++++%3Clinks%3E%0A++++++%3Clink%3E%0A++++++++%3Clabel%3ETune+in+Now%3C%2Flabel%3E%0A++++++++%3C%55%52%4C%3E%6A%61%76%61%73%63%72%69%70%74%3A%70%6F%70%55%70%28%27%68%74%74%70%3A%2F%2F%6F%70%2E%6C%6F%63%61%6C%68%6F%73%74%2E%63%6F%6D%2F%27%29%3C%2F%55%52%4C%3E%0A++++++%3C%2Flink%3E%0A++++++%3C%2Fslide%3E%0A"; 
     }}} ?>
    		
    		%2Fpromo_slides%3E%0A", majorversion:"8", build:"0", xi:"true", ximovie:"/flashnews/ufo_051507.swf" };
    		UFO.create(FO, "topmod");
    		</script>
    
    
    <div id="topmod">
    You need the Flash Player plug-in to see this portion of the Movies Home Page.  You can download the plug-in by clicking the link below.
    <p><a href="http://www.adobe.com/go/getflashplayer">http://www.adobe.com/go/getflashplayer</a>
    		
    
    </div>
    I've colored the output in RED so you guys know what I'm talking about... I've only done 1 output thus far as more will come out just like the one in red.

    Any kind of help would be greatly appreciated.

  2. #2
    Join Date
    Feb 2005
    Location
    Australia
    Posts
    5,842
    Looks like what you really want to do is urlencode the stuff you're inserting.
    Chris

    "Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them." - Laurence J. Peter

  3. #3
    Join Date
    Apr 2006
    Posts
    1,120
    Just for reference, Java and Javascript are two entirely different things. Your thread title is a bit misleading...

  4. #4
    Join Date
    Apr 2005
    Posts
    694
    well basically the javascript is embedding the whole xml file in the flashvars. I thought to put the php command right in the middle, but it doesn't seem to help.

  5. #5
    Join Date
    Feb 2005
    Location
    Australia
    Posts
    5,842
    Flashvars should be encoded exactly like a query string. Replace your bin2hex with urlencode and you'll probably get what you want.
    Chris

    "Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them." - Laurence J. Peter

  6. #6
    Join Date
    Apr 2005
    Posts
    694
    I get a javascript error. I'm not sure if I can just pause the javascript and then throw in my php code in the middle like that and hopping it to pick up. Can I put the xml contents in an external file instead? That way it's not encoded and probably will be easier to put the php code there.

    From reading what I have, what do you recommend me doing as far as hoping to return 4 outputs right in the middle of that javascript.

  7. #7
    Join Date
    Feb 2005
    Location
    Australia
    Posts
    5,842
    You're not pausing the javascript, the text you insert with PHP will be treated exactly as if it was part of a static document. View the source of your page to see what you're actually putting in - javascript errors are most likely caused by line breaks that shouldn't be there.
    Chris

    "Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them." - Laurence J. Peter

  8. #8
    Join Date
    Apr 2005
    Posts
    694
    thank you so much! Without you, it would probably take me another week or so. Thanks for pointing that out...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •