".$news[$ga++]["title"]."
\n"; } */ function parse_rss2($filename) { $xml = simplexml_load_file($filename); foreach($xml->channel->item as $news) { echo '', utf8_decode((string) $news->title), '
'; } } class RSSDisplay { public $fichierRss; function __construct($fichierRss) { $this->fichierRss = $fichierRss; $xml = simplexml_load_file($fichierRss); echo ''; } } //************************************************ //* renvoie les titres d'un fichier backend RSS ** //************************************************ /* function parse_rss($filename) { $php_ver = phpversion(); if ($php_ver[0] >= 5) { $s = simplexml_load_file($filename); foreach ($s->channel->item as $news) { $items[$cpt]["title"] = $news->title; echo $items[$cpt]["title"]; $items[$cpt++]["link"] = $news->link; } } else { global $convert; //$trans["&"] = "&"; $trans[">"] = ">\n"; if (isset($convert) && $convert="on") $data = strtr(implode("",file($filename)),$trans); else $data = implode("",file($filename)); // initialise les compteurs $cpt = 0; $index_item = 0; // parse le fichier et remplit les tableaux $p = xml_parser_create(""); xml_parser_set_option($p, XML_OPTION_TARGET_ENCODING, "iso-8859-1"); xml_parse_into_struct($p,$data,&$vals,&$index); xml_parser_free($p); // parcourt et récupère les données foreach($index as $key->$val) { $array = $key->$val; $pos = $array[0]; $tag = $vals[$pos][tag]; $val = $vals[$pos][value]; if ($tag == "ITEM") { while ($index[ITEM][$index_item] != "") { $tag2 = $vals[$index[ITEM][$index_item]+1][tag]; $value2 = $vals[$index[ITEM][$index_item]+1][value]; $index_item++; if ($tag2 == "TITLE") { $items[$cpt]["title"] = utf8_decode($value2); // echo "$value2"; } if ($tag2 == "LINK") $items[$cpt++]["link"] = $value2; } } } } return $items; } */ ?>