génération de playlist en PHP
Bonjour,
je souhaite avoir une "playlist" qui se génère en fonction des mp3 chargés dans un dossier (/mp3...) et également en fonction des informations de ma base SQL :
Merci beaucoup !
mes codes ci-dessous :
morceaux.php (récupère les informations de ma base SQL => OK) :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>MON SITE</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<?php include('bandeau.php'); ?> <!-- insère le bandeau principal en haut -->
<div id="mainContent">
<br />
<a><strong>Morceaux de la semaine :</strong></a>
<p />
<object type="application/x-shockwave-flash" data="dewplayer-playlist.swf" width="240" height="200" id="dewplayer" name="dewplayer">
<param name="wmode" value="transparent" />
<param name="movie" value="dewplayer-playlist.swf" />
<param name="flashvars" value="showtime=true&autoreplay=true&xml=playlist.xml" />
</object>
<br />
<a><strong>Informations sur les auteurs :</strong></a>
<br />
<br />
<!-- debut de la requête pour récupérer les informations des groupes de musique -->
<?php
// connexion à la base
require("configuration.php");
$sql = connect_sql();
// on écrit la requête
$select = "SELECT * FROM morceaux_groupe ORDER BY numero";
$result = mysql_query($select) or die ('Erreur : '.mysql_error() );
$total = mysql_num_rows($result);
//On vérifie que la table contient quelque chose
if
(mysql_num_rows($result) == 0)
{
echo '<p>'.'<b>'.'Aucun morceau ! '.'</b>'.'</p>'.'<br>'.'</br>';
echo '<a href="javascript:window.history.go(-1)">'.'Retour'.'</a>'; // retour en page précédente
}
//Si il y a des entrées
else
{
//On fait une boucle pour sortir toutes les entrées
while($affiche = mysql_fetch_array($result))
{
//On affiche les entrées
echo '<br />';
echo '<b>'.$affiche["nom_groupe"]." ".'</b>';
echo '<div class="autre">';
echo '<span style="color:#8E236B;">';
echo '<strong>';
echo " ".$affiche["titre"]." ";
echo '</strong>';
echo '</span>';
echo '<div class="cache">';
echo '<strong>';
echo '<br />';
echo '<a href="'.$affiche["site_web"].'">'.'Site web du groupe'.'</a>';
echo '<br />';
echo " ".$affiche["descriptif_groupe"]." ";
echo '<br />';
echo '<br />';
echo " mis en ligne par ".$affiche["pseudo_groupe"]." ";
echo '</strong>';
echo '</div>';
echo '</div>';
echo '<br />';
} //On ferme la boucle while
} //on ferme le else
// Fermeture de la connexion à la base de données
mysql_close();
?>
</div>
<?php include('bas_de_page.php'); ?> <!-- insère le bas de page -->
</body>
</html> |
playlist.xml :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| <?xml version="1.0" encoding="UTF-8"?>
<playlist version="1" xmlns="http://xspf.org/ns/0/">
<title>Playlist</title>
<creator>Dew</creator>
<trackList>
<track>
<location>mp3/test1.mp3</location>
<title>La Moldau (Smetana)</title>
</track>
<track>
<location>mp3/test2.mp3</location>
<title>Saia Travada</title>
</track>
<track>
<location>mp3/test3.mp3</location>
<title>Katusha</title>
</track>
</trackList>
</playlist> |