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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
if (is_file(IOFILE2)) {
$doc2->load(IOFILE2);
$element = $doc2->documentElement;//->getElementsByTagName('content')->item(0); // Pour être sûr
echo"on est dans le if";
}
else {
$elementrss = $doc2->createElement('rss','');
$elementrss->setAttribute("version","2.0");
$doc2->appendChild($elementrss);
echo "on est dans le else";
$element = $doc2->createElement('channel','');
$elementrss->appendChild($element);
$paramtitreprincipal=$doc2->createElement('title',"Flux rss Ecofaubourgs");
$element->appendChild($paramtitreprincipal);
$paramlink=$doc2->createElement('link',"http://www.ecofaubourgs.com");
$element->appendChild($paramlink);
$paramdescription=$doc2->createElement('description',"La ville est un espace naturel");
$param4 = $doc2->createElement('image',"images/stories/articles_thumb/".$photo);
$element->appendChild($param4);
$element2 = $doc2->createElement('item','');
$element->appendChild($element2);
}
$param1 = $doc2->createElement('title',$titre);
$element2->appendChild($param1);
$param5 = $doc2->createElement('link','index.php?option=com_newspaper&view=newspaper&Itemid=9&article='.$id.'&lang=fr');
$element2->appendChild($param5); // index.php?option=com_newspaper&view=newspaper&Itemid=9&article=88&lang=fr
//$param2 = $doc2->createElement('date',$dateCreation);
//$element2->appendChild($param2);
$param3 = $doc2->createElement('description','');
$element2->appendChild($param3);
$paramdata = $doc2->createCDATASection($texte_intro);
$param3->appendChild($paramdata);
$doc2->save(IOFILE2); |
Partager