Ver Mensaje Individual
  #4 (permalink)  
Antiguo 20/10/2009, 08:59
diegocespedes
 
Fecha de Ingreso: noviembre-2008
Ubicación: W2.0
Mensajes: 103
Antigüedad: 15 años, 5 meses
Puntos: 1
Respuesta: Duda desarrollando RSS con PHP

Este sería el link que dirige a tu rss

Código HTML:
<a type="application/rss+xml" href="dir.php" target="_blank">
<img src="images/rss.png" width="45" height="45" /> 
[/QUOTE]


Este sería el código rss


Código PHP:
<?php
header
('Content-Type: application/rss+xml'); 
$dbhost="localhost";
$dbuser="user";
$dbpass="xxxx";
$db="web_gurx";
mysql_connect($dbhost,$dbuser,$dbpass);
mysql_select_db($db);
echo 
'<?xml version="1.0" encoding="ISO-8859-1" ?>';
?>
<rss version="2.0">
<channel>
<title>Linux, FreeBSD, Programación, Hack, ...</title>
<link>http://www.XXXX.net/rss/</link>
<description>bla bla bla</description>
<generator>XXXX.net</generator>
<?
$sql 
"SELECT * FROM bdrss ";
$resultado=mysql_query($sql);
while (
$registre=mysql_fetch_array($resultado)){
    echo 
'<item>';
    echo 
'<title>'.$registre["titol"].'</title>';
    echo 
'<link>http://www.xxxx.net/index.php?sec=documentacio&amp;element='.$registre["id"].'</link>';
    echo 
'<pubDate>'.$registre["data"].'</pubDate>';
    echo 
'<category>'.$registre["tematica"].'</category>';
    
//echo '<description><![CDATA['.substr($registre["text"],0,100).'...]]></description>';
    
echo '</item>';
}
?>
</channel>
</rss>