Html_entities o que ??
| From: | Reynier Perez Mira | Date: | Sat, 22 Oct 2005 14:14:12 +0000 |
| Subject: | Html_entities o que ?? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-224450@lists.php.net to get a copy of this message | ||
Hola lista:
Resulta que estoy tratando de crear un RSS 2.0 para mi web y estoy medio que parado por ciertas y
determinadas cosillas. La primera es que las noticias las introduzco en la BDatos usando un editor
WYSIWYG (TinyMCE Editor) y entonces en los campos TEXT de la tabla me sale contenido HTML. Por
ejemplo si alineo el contenido del TEXTAREA a la derecha me introduce esto en la Bdatos:
================================================
<div align="right">CONTENIDO</div>
================================================
Entonces a la hora de mostrar el fichero XML generado me da problemas porque en el área de la
descripción me sale todo ese código HTML. Miren el código para hacer el RSS:
================================================
$contar_noticias = $db->Execute("SELECT COUNT(IDN) AS cantidad FROM noticia");
$rscantidad = $contar_noticias->fetchRow();
# RSS File
$res = "";
$res.= "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
$res.= "<rss version=\"2.0\">\n";
$res.= "\t<channel>\n";
$res.= "\t\t<title><![CDATA[RSS Portal de los Joven Club de Computación
y Electrónica de Granma]]></title>\n";
$res.= "\t\t<description><![CDATA[RSS Portal de los Joven Club de
Computación y Electrónica de Granma]]></description>\n";
$res.= "\t\t<language>es-es</language>\n";
$res.= "\t\t<generator>RSS Portal JClub Granma</generator>\n";
if ($rscantidad[0] > 0) {
$fecha_noticias= $db->SQLDate('d M Y - h:i:s A', 'FechaN');
$noticia = $db->Execute("SELECT IDN, IDC, $fecha_noticias, TituloN, DescN,
AutorN FROM noticia WHERE (NACtiva<>0) ORDER BY FechaN DESC");
while ($rs=$noticia->fetchRow()) {
$res.="\t\t<item>\n";
$res.="\t\t\t<title><![CDATA[" .
stripslashes($rs['TituloN']) . "]]></title>\n";
// $res.="\t\t\t<description><![CDATA[" .
stripslashes($rs['DescN']) . "]]></description>\n";
$res.="\t\t\t<pubDate>" . stripslashes($fecha_noticias) .
"</pubDate>\n";
$res.="\t\t\t<link>" . $PageAdress . "&IDC=" .
$rs['IDC'] . "&IDN=" . $rs['IDN'] .
"</link>\n";
$res.="\t\t\t<author>" . stripslashes($rs["AutorN"]) .
"</author>\n";
$res.="\t\t</item>\n";
}
}
$res.= "\t</channel>\n";
$res.= "</rss>\n";
$actual =date("Ymd");
$handler=fopen("../noticias-" . $actual . ".xml", 'w+');
if (!fputs($handler, $res)) {
$tpl->assign("msg","No se pudo crear el RSS");
} else {
$tpl->assign("msg","El fichero RSS ha sido creado
satisfactoriamente");
}
fclose($handler);
$file = "noticias-" . $actual . ".xml";
$tpl->assign('file', $file);
================================================
Luego el otro problema y un poco OFF TOPIC es que no se como decirle a un arhivo XML que use un
fichero XSL para poder mostrar el fichero XML con estilo.
Salu2 y gracias de antemano
ReynierPM