Problème tutoriel Création d'un système RSS
Bonjour,
après pas mal de recherche je suis tombé sur ce tutoriel ce pour créer un flux rss à avec php, j'ai voulu testé le tuto mais lors de l'exécution j'ai une erreur:
Citation:
Fatal error: Call to a member function appendChild() on a non-object in /usr/local/www/data/loopback/www/include/fonctions_xml.php on line 58
l'erreur se situe dans la fonction addOneNews :
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
| function addOneNews($file, $title, $timestamp, $author){
//On récupère le channel
$element_channel = $file->getElementById("news");
// Création du noeud item
$element_item = $file->createElement("item");
$element_item = $element_channel->appendChild($element_item);
// Création du noeud title et ajout du texte à l élément
$element_title = $file->createElement("title");
$element_title = $element_item->appendChild($element_title);
$texte_title = $file->createTextNode($title);
$texte_title = $element_title->appendChild($texte_title);
// Création du noeud link et ajout du texte à l élément
$element_link = $file->createElement("link");
$element_link = $element_item->appendChild($element_link);
$texte_link = $file->createTextNode("Lien vers la news");
$texte_link = $element_link->appendChild($texte_link);
// Création du noeud pubDate et ajout du texte à l élément
$element_date = $file->createElement("pubDate");
$element_date = $element_item->appendChild($element_date);
$texte_date = $file->createTextNode($date("d/m/Y H\hi",$timestamp));
$texte_date = $element_date->appendChild($texte_date);
// Création du noeud author et ajout du texte à l élément
$element_author = $file->createElement("author");
$element_author = $element_item->appendChild($element_author);
$texte_author = $file->createTextNode($author);
$texte_author = $element_author->appendChild($texte_author);
} |
la ligne 58 dans le code correspond à cette ligne:
Code:
$element_item = $element_channel->appendChild($element_item);
J'avoue que je ne comprend pas trop le code ici sauf que je sais qu'il sert à à ajouter la news
Si quelqu'un pouvais m'aider sur ce soucis ça serait bien.
Merci d'avance