I have a simple site put together to play a few flash videos. I have the information for the videos and their related comments stored in an xml file. I use SimpleXML to iterate through all of this and display the stuff in reverse chronological order. Everything works perfectly in IE8, Safari, and Chrome, but in Firefox the same video (the one at [0] in the simpleXML array) is shown for all the videos on the screen. All the related information (Title, comments, etc.) is correct, and viewing the html output shows that the FLV Player is calling to the correct file...but Firefox won't show it!
So: Is there some quirk in the Firefox DOM that I can account for in the php scripts? What can I do? The page is here: http://omega.uta.edu/~ktb7964/
And some source code for you: The PHP loops:
<?php
//this script uses a few for loops to first count the number of video/comment entries in the related xml file,
//and then count backwards through them so they are all displayed in reverse chronological order.
//$v is the array position for a video element and $c is the array position for a comment element.
for($v=0; $xml->video[$v];$v++) {}
$v--;
for($v; $v >= 0;$v--) {
//the code that declares the FLV player needs to be split into pieces so we can concatenate them with $v.
$script1 = file_get_contents('script1.htm');
$script2 = file_get_contents('script2.htm');
$script3 = file_get_contents('script3.htm');
$script4 = file_get_contents('script4.htm');
echo("<h2>" . $xml->video[$v]->title . "</h2>");
echo($script1 . $v . $script2 . $xml->video[$v]->file . $script3 . $xml->video[$v]->url . $script4);
echo("<h3>Comments:</h3>");
echo("<form action=\"post".$v.".php\" method=\"post\" name=\"postcomment".$v."\">");
echo("<input name=\"position\" type=\"hidden\" value=\"".$v."\" />");
echo("<input name=\"username\" type=\"text\" size=\"30\" maxlength=\"20\" value =\"Username:\" onblur=\"if(this.value=='') this.value='Username:';\" onfocus= \"this.value='';\" /></p>");
echo("<p><textarea name=\"text\" cols=\"50\" rows=\"5\"></textarea></p>");
echo("<input name=\"submit\" type=\"submit\" value=\"Post a Comment\" />");
echo("</form>");
for($c=0; $xml->video[$v]->comments->comment[$c];$c++) {}
$c--;
if($c < 0){
echo("<p><i>No comments yet.</i></p>");}
else {
for($c; $c >= 0; $c--) {
echo("<h4>" . $xml->video[$v]->comments->comment[$c]->poster . " said: </h4>");
echo("<p>" . $xml->video[$v]->comments->comment[$c]->post . "</p>");
echo("<hr />"); }
}
}
?>
And one section of the xml file:
<videos>
<video>
<uid>0</uid>
<title>The Real World: UTA</title>
<file>draft</file>
<comments>
<comment>
<poster>Fooman</poster>
<email>[email protected]</email>
<post>"This video is so exciting!</post>
</comment>
<comment>
<poster>Foogirl</poster>
<email>[email protected]</email>
<post>"Ha! That was hilarious!"</post>
</comment>
</comments>
</video>
</videos>
Thank you!