En fait dans ma fonction add_news_node
j'utilise CreateElement.
Voilà la fonction :
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
| function add_news_node(&$parent, $root, $titre, $description, $img, $url, $date_creation)
{
$item = $parent->createElement("item");
$item = $root->appendChild($item);
$title = $parent->createElement("title");
$title = $item->appendChild($title);
$text_title = $parent->createTextNode($titre);
$text_title = $title->appendChild($text_title);
$desc = $parent->createElement("description");
$desc = $item->appendChild($desc);
$text_desc = $parent->createTextNode($description);
$text_desc = $desc->appendChild($text_desc);
$image= $parent->createElement("image");
$image = $item->appendChild($image);
$text_image = $parent->createTextNode($img);
$text_image = $image->appendChild($text_image);
$link = $parent->createElement("link");
$link = $item->appendChild($link);
$text_link = $parent->createTextNode($url);
$text_link = $link->appendChild($text_link);
$pubDate = $parent->createElement("pubDate");
$pubDate = $item->appendChild($pubDate);
$text_pubDate = $parent->createTextNode($date_creation);
$text_pubDate = $pubDate->appendChild($text_pubDate);
} |
Est-ce que si je remplace l'appel de ma fonction par cela ça devrait fonctionner :
add_news_node($xml_file, $channel, utf8_encode($valeur["titre"]), utf8_encode($description), utf8_encode($valeur["image"]), utf8_encode($url), $valeur["date_creation_deal"]);
Je vais tester. Je vous dirai.
Partager