xml til Flash via PHP
HejHar prøvet at få en simpel videoafspiller til at fungere gennem en xml-fil, som jeg danner via et lille php script.
scriptet ser således ud:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>test</title>
</head>
<body>
<?php
$ftitel = $_REQUEST[filmtitel];
if ($ftitel == '') {
$dom = new DomDocument();
$dom->preserveWhiteSpace = FALSE;
$dom->loadXML($xml);
$tit = $dom->getElementsByTagName('title');
$ftitel = utf8_decode($tit -> nodeValue);
echo $ftitel.'<br>';
} else {
$doc = new DOMDocument();
// we want a nice output
// $doc->formatOutput = true;
$title = $doc->createElement('title');
$title = $doc->appendChild($title);
//$ftitel = utf8_encode($ftitel);
$text = $doc->createTextNode("$ftitel");
$text = $title->appendChild($text);
echo 'Wrote: ' . $doc->save("test.xml") . ' bytes';
$ftitel = utf8_decode($ftitel);
}
?>
<table align="center">
<tr>
<td align="center"><div class="dagbog"><?php echo substr($ftitel,0,strpos($ftitel,".flv"))?></div></td>
</tr>
<tr>
<td align="center">
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase= "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="320" height="282" id="test" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="false" />
<param name="movie" value="test.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /> <embed src="test.swf" quality="high" bgcolor="#ffffff" width="320" height="282" name="test" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
</td>
</tr>
<tr>
<form id="form1" name="form1" method="post" action="../visfilm.php">
<td align="center">
<?php // husk dette: index.php?id=<?php echo $id ?>
<select name="filmtitel" id="select">
<?php
if ($handle = opendir('.')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && strstr($file, ".flv")) { ?>
<option value="<?php echo $file?>"><?php echo substr($file,0,strpos($file,".flv"))?></option>
<?php }
}
closedir($handle);
}
?>
</select>
<input type="submit" name="button" id="button" value="Start" />
</td>
</form>
</tr>
</table>
</body>
</html>
Har set at .SWf fungere med xml-scriptet. Men det fungere bare ikke anden gang jeg vælger en film fra den genererede liste ??
Håber der er nogen der har lyst/tid til at hjælpe
