appendChild(new DOMElement($nombreTag)); $tag->appendChild($dom->createTextNode($text)); return $tag; } // $dom = new DOMDocument('1.0', 'ISO-8859-1');//SI O SI /*/feed.css"?>*/ $rss = $dom->appendChild(new DOMElement('rss')); $rss->setAttributeNode(new DOMAttr('version', '2.0')); $channel = $rss->appendChild(new DOMElement('channel')); tag("title", NOMBRE_EMPRESA, $channel, $dom); tag("link", substr(URL_SISTEMA,0,-1), $channel, $dom); tag("description", utf8_encode("Nuestros ultimos vehículos de ocasión"), $channel, $dom); tag("copyright", "Copyright 2006 LOGin Desarrollos - All rights reserved", $channel, $dom); tag("pubDate", date("r",str_replace(" "," ",time())), $channel, $dom); tag("managingEditor", "info@logindesarrollos.com.ar", $channel, $dom); tag("webMaster", "web@logindesarrollos.com.ar", $channel, $dom); tag("ttl", 10, $channel, $dom); $category = tag("category", "", $channel, $dom); $category->setAttributeNode(new DOMAttr('domain', 'RoyalWagen')); tag("generator", utf8_encode("Detalle de vehículos"), $channel, $dom); $image = $channel->appendChild(new DOMElement('image')); tag("title", NOMBRE_EMPRESA, $image, $dom); tag("url", URL_SISTEMA."img/logoRss.gif", $image, $dom); tag("link", substr(URL_SISTEMA,0,-1), $image, $dom); tag("lastBuildDate", str_replace(" "," ",date("r",time())), $channel, $dom); $db->query("SELECT A.idVehiculo, A.modelo, A.fecha_matriculacion, A.tipo_motor, A.color, A.kilometraje, A.idMarca, A.volumen_motor, A.tipo_cambio, A.llantas, A.turbo, A.inyeccion, A.aireacond, A.climatizador, A.navegador, A.alarma, A.precio_venta_publico, A.comentario, A.fecha_alta, B.nombre as marca, B.imagenExt as marcaImg, C.nombre AS categoria FROM vehiculos AS A LEFT JOIN marcas AS B ON A.idMarca=B.idMarca LEFT JOIN categorias AS C ON A.idCategoria=C.idCategoria WHERE A.activo=1 AND A.vendido=0 ORDER BY A.fecha_alta DESC limit 20", "autos"); while($d = $db->fetchArray("autos")){ $item = $channel->appendChild(new DOMElement('item')); tag("title", utf8_encode("Vehículo: ".$d['categoria']." ".$d['marca']." ".$d['modelo']." Mod.".date('Y', $d['fecha_matriculacion'])." € ".number_format($d['precio_venta_publico'], 2, ",", ".")), $item, $dom); tag("link", URL_SISTEMA."?se=ficha&ve=".$d['idVehiculo'], $item, $dom); ob_start(); ob_implicit_flush(0); include("fichaRss.php"); $message = ob_get_contents(); ob_end_clean(); $des = $item->appendChild(new DOMElement('description')); $des->appendChild($dom->createCDATASection(utf8_encode($message))); tag("pubDate",str_replace(" "," ",date("r",$d['fecha_alta'])), $item, $dom); tag("guid", URL_SISTEMA."/?se=ficha&ve=".$d['idVehiculo'], $item, $dom); } echo $dom->saveXML(); ?>