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
| <?php
# Configuration
$fichier_xml = "http://www.site.com/xml.php"; # Placez ici l'adresse du flux
$nombre_limite = 1; # Nombre maximum d'éléments à afficher
# Affichage du Flux
$file = fopen($fichier_xml,"r");
if ($file) {
while (!feof($file)) $raw .= fread($file,32000);
fclose( $file );
if(eregi("<item>(.*)</item>",$raw,$rawitems)){
$items = explode("<item>", $rawitems[0]);
$nb = count($items);
$maximum = (($nb-1) < $nombre_limite) ? ($nb-1) : $nombre_limite;
for ($i=0;$i<$maximum;$i++) {
eregi("<longue_description>(.*)</longue_description>",$items[$i+1], $title);
eregi("<thumbs_path>(.*)</thumbs_path>",$items[$i+1], $link);
eregi("<taille>(.*)</taille>",$items[$i+1], $taille);
eregi("<duree>(.*)</duree>",$items[$i+1], $duree);
echo "- <a href=\"".$link[1]."\" target=\"_blank\">".$title[1]."</a><br />";
echo "- <img src=\"".$link[1].""02.jpg\" >";
//Le code est faux, mais j'essaye de rajouter /02.jpg à la suite du chemin car le flux xml me donne juste le lien vers un dossier
}
}
}
?> |
Partager