'; $xml .= ''; $xml .= 'Freesynd News'; $xml .= 'http://freesynd.sourceforge.net/'; $xml .= 'Recent news from the Freesynd project.'; $lastBuildDate = date(DATE_RSS, filemtime($newsPath)); $xml .= '' . $lastBuildDate . ''; foreach ($xmlFile->item as $item) { $xml .= ''; // News title $xml .= '' . htmlentities($item['title']) . ''; // link $xml .= 'http://freesynd.sourceforge.net/index.php#n' . $item['id'] . ''; // News content $xml .= '' . $item['rssDesc'] . ''; $dtTime = DateTime::createFromFormat('Y-m-d', $item['date']); $xml .= '' . $dtTime->format("D, d M Y") .' 09:00:01 GMT'; $xml .= 'http://freesynd.sourceforge.net/index.php#n' . $item['id'] . ''; $xml .= ''; } // édition de la fin du fichier XML $xml .= ''; $xml .= ''; // écriture dans le fichier $fp = fopen($destPath, 'w+'); if (!$fp) { return "Cannot open news file"; } if(fputs($fp, $xml) == false) { return "Cannot write to file " . $destPath; } fclose($fp); return FALSE; } ?>