I use the free XSPF flash player to play my music on my website. I am taking info from the database and generating the playlist "on-the-fly" for that song. However, it works on FireFox but not IE. I have tried a couple different Content-Types in the header but to no avail.
Here is the exact code in the PHP file, and a link so you can view the output.
To test the site on IE:
http://www.dannydotguitar.com/index.php
And click the little Play arrow button next to a song name.
XML output:
http://www.dannydotguitar.com/playlist.php?id=3
Playlist.php source code:
PHP Code:<?php
require_once('include/vars.php');
header('Content-Type: text/xml');
header("Pragma: no-cache");
header("Cache-Control: no-cache, must-revalidate, max_age=0");
header("Expires: 0");
require_once('include/db.php');
$dbc = db_connect();
?>
<?php echo '<'; echo '?xml version="1.0" encoding="UTF-8"'; echo ' ?'; echo '>'; ?>
<?php
function append_ifnot($p_string, $p_append) {
if(substr($p_string, -strlen($p_append)) != $p_append) {
return $p_string.$p_append;
} else {
return $p_string;
}
}
if(is_numeric($_GET['id'])) {
$settings['site_url'] = 'http://www.dannydotguitar.com/';
$q = "SELECT * FROM songs WHERE id='{$_GET['id']}' LIMIT 1";
$r = mysql_query($q) or die(mysql_error());
if(@mysql_num_rows($r)>0) {
$song = mysql_fetch_array($r, MYSQL_ASSOC);
?>
<playlist version="0" xmlns="http://xspf.org/ns/0/">
<title><?php echo $song['name']; ?></title>
<info><?php echo append_ifnot($settings['site_url'],'/') . 'view_song.php?id=' . $song['id']; ?></info>
<trackList>
<track>
<location><?php echo append_ifnot($settings['site_url'],'/'); ?>songs/<?php echo $song['url']; ?></location>
<?php
if(strlen($song['image_url'])) {
?>
<image><?php echo append_ifnot($settings['site_url'],'/'); ?>images/songs/<?php echo $song['image_url']; ?></image>
<?php
}
if(strlen($song['description'])) {
?>
<annotation><?php echo substr(strip_tags($song['description']),0,57) . '...'; ?></annotation>
<?php
}
?>
<creator>Danny Elkins</creator>
<?php
if(strlen($song['name'])) {
?>
<title><?php echo $song['name']; ?></title>
<?php
}
if(strlen($song['runtime'])) {
?>
<duration><?php echo $song['runtime']; ?></duration>
<?php
}
?>
</track>
<?php
}
}
unset($song);
?>
</trackList>
</playlist>




Reply With Quote