У меня есть простой сайт для воспроизведения нескольких флеш-видео. У меня есть информация для видео и связанных с ними комментариев, которые хранятся в файле XML. Я использую SimpleXML, чтобы перебрать все это и отобразить материал в обратном хронологическом порядке. Все отлично работает в IE8, Safari и Chrome, но в Firefox одно и то же видео (в [0] в массиве simpleXML) показывается для всех видео на экране. Вся соответствующая информация (заголовок, комментарии и т. Д.) Верна, и просмотр вывода html показывает, что FLV Player вызывает правильный файл ... но Firefox не покажет его!
Итак: есть ли какая-то особенность в Firefox DOM, которую я могу объяснить в сценариях php? Что я могу сделать?
Страница находится здесь: http://omega.uta.edu/~ktb7964/
И некоторый исходный код для вас:
Циклы PHP:
<?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 />"); }
}
}
?>
И один раздел XML-файла:
<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>
Спасибо!