} break; } } // find yakcat from ofcat in the db $cat = ''; $yakcatColl = $db->yakcat; $res = $yakcatColl->find(array('ext_id.of' => (string) $GenreId)); foreach ($res as $acat) { $cat .= "#" . $acat['_id']; } $datpar = $Date[3]['annee'] . "-" . $Date[3]['mois'] . "-" . $Date[3]['jour']; $pubDate = DateTime::createFromFormat('Y-m-d', $datpar); $thumb = ''; if (!empty($photo[0]) && $photo[0]['Path'] != '') { $thumb = $conf->originalurl() . $photo[0]['Path']; } $itemArray = array('title' => $Titre, 'content' => $Corps_Debut . " " . $Corps_Descriptif . " " . $Corps_Fin, 'outGoingLink' => $url, 'thumb' => $thumb, 'yakCats' => $cat, 'freeTag' => '', 'pubDate' => $pubDate->format(DateTime::ISO8601), 'address' => $Nom . ", " . $Org_Commune . ", Bretagne, France", 'place' => $Nom . ", " . $Org_Commune, 'longitude' => $longitude, 'latitude' => $latitude, 'telephone' => '', 'mobile' => '', 'mail' => '', 'transportation' => '', 'web' => $Site_Internet, 'opening' => '', 'eventDate' => $eventDateTotal); unset($Date_ev); unset($Date); unset($Commune); $xml .= buildXMLItem($itemArray); } } } // echo or write the file according to env var if (substr($conf->deploy, 0, 3) == 'dev') { header("Content-Type: application/rss+xml; charset=utf-8"); echo $header . $xml . $footer; } else { $fh = fopen('/usr/share/nginx/html/DATA/' . $file, 'w') or die("error");