开发者

Firefox-only bug when calling .flv videos from xml file using php

开发者 https://www.devze.com 2022-12-18 17:49 出处:网络
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

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,开发者_Go百科 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>fooman@domain.com</email>
                <post>"This video is so exciting!</post>
            </comment>
            <comment>
                <poster>Foogirl</poster>
                <email>foogirl@domain.com</email>
                <post>"Ha! That was hilarious!"</post>
            </comment>
        </comments>
    </video>
</videos>

Thank you!


Well first of all you have spaces in at least some of your id attribs for the object tags like: id="FLVPlayer 0". id's must be a continuous string if you need separators use underscores or hyphens.

I would first try to get it to validate as much as possible. Some of the warnings here are going to be unavoidable because of flash and crossbrowser support so youll have to work around those, but the non flash stuff should vaildate.

http://validator.w3.org/check?uri=http%3A%2F%2Fomega.uta.edu%2F~ktb7964&charset=%28detect+automatically%29&doctype=Inline&group=0

0

精彩评论

暂无评论...
验证码 换一张
取 消