<?php extract($themeset, EXTR_OVERWRITE); $rootdir="/home/www/website/backends/xml/"; global $nbnews; global $titre; if (file_exists($rootdir.$source) && filesize($rootdir.$source) != 0) { //$rss = simplexml_load_string(utf8_encode(implode(" ",file($rootdir.$source)))); $rss = simplexml_load_file($rootdir.$source); if (!($rss)) echo "failed to decode XML for $source"; if (!isset($nbnews)) { //$nbnews = $index_title; $nbnews = 10; } $ga = 0; if ($rss->channel->item->link) { while($ga<=$nbnews-1) { $link = str_replace("&","&", $rss->channel->item[$ga]->link); $title = $rss->channel->item[$ga++]->title; //$title = str_replace("& ","&", $title); //$title = str_replace("’","'", $title); //$title = str_replace("…","...", $title); echo "\t\t<a href='".$link."' target='_blank'>".utf8_decode($title)."</a><br />\n"; } } else { while($ga<=$nbnews-1) { $link = str_replace("&","&", $rss->item[$ga]->link); $title = $rss->item[$ga++]->title; //$title = str_replace("& ","&", $title); //$title = str_replace("’","'", $title); //$title = str_replace("…","...", $title); echo "\t\t<a href='".$link."' target='_blank'>".utf8_decode($title)."</a><br />\n"; } } } else echo "Fichier source introuvable ou corrompu ($source)<br />"; ?>