Tema: RSS con PHP
Ver Mensaje Individual
  #10 (permalink)  
Antiguo 07/10/2009, 11:15
Avatar de lvfp
lvfp
 
Fecha de Ingreso: septiembre-2005
Ubicación: España
Mensajes: 337
Antigüedad: 18 años, 7 meses
Puntos: 4
Respuesta: RSS con PHP

Bien, no he podido hablar aun con mi proveedor pero he solucionado el problema y eso me mosquea. Me explico he hecho un archivo php con dreamweaver usando la misma conexión y sustituyendo el contenido del bucle, que generaba una tabla de datos, por el bucle del rss. Y he añadido los "echo" que general el resto de tags del xml... queda así:

Código PHP:
<?php require_once('Connections/ourol.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function 
GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  if (
PHP_VERSION 6) {
    
$theValue get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  
$theValue function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch (
$theType) {
    case 
"text":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;    
    case 
"long":
    case 
"int":
      
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case 
"double":
      
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case 
"date":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;
    case 
"defined":
      
$theValue = ($theValue != "") ? $theDefinedValue $theNotDefinedValue;
      break;
  }
  return 
$theValue;
}
}

$maxRows_Recordset1 10;
$pageNum_Recordset1 0;
if (isset(
$_GET['pageNum_Recordset1'])) {
  
$pageNum_Recordset1 $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 $pageNum_Recordset1 $maxRows_Recordset1;

mysql_select_db($database_ourol$ourol);
$query_Recordset1 "SELECT licitacion.codigo, licitacion.nombre, licitacion.tipo FROM licitacion ORDER BY codigo DESC";
$query_limit_Recordset1 sprintf("%s LIMIT %d, %d"$query_Recordset1$startRow_Recordset1$maxRows_Recordset1);
$Recordset1 mysql_query($query_limit_Recordset1$ourol) or die(mysql_error());
$row_Recordset1 mysql_fetch_assoc($Recordset1);

if (isset(
$_GET['totalRows_Recordset1'])) {
  
$totalRows_Recordset1 $_GET['totalRows_Recordset1'];
} else {
  
$all_Recordset1 mysql_query($query_Recordset1);
  
$totalRows_Recordset1 mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
header('Content-Type: text/xml');
    echo 
'<?xml version="1.0" encoding="iso-8859-15"?>';
     echo 
'<rss version="2.0"> 
    <channel> 
    <title>Canal RSS del perfil del contratante - Concello de Ourol</title> 
    <link>http://www.concellodeourol.es/licitaciones/</link> 
    <description>Licitaciones del Concello de Ourol</description>'

?>

  <?php do { ?>
   <?php echo '<item><title>'.$row_Recordset1['tipo'].'</title>
      <link>http://www.concellodeourol.es/licitaciones/licitaciones.php?codigo='
.$row_Recordset1['codigo'].'</link>
   <description>'
.$row_Recordset1['nombre'].'</description>
    </item>'
?>
     
    
    <?php } while ($row_Recordset1 mysql_fetch_assoc($Recordset1)); ?>


<?php
echo '</channel>
</rss>'
;
mysql_free_result($Recordset1);
?>
(Ya sé que sobran cosas pero como no soy experto en php prefiero no tocar)

Y de esta forma funciona perfectamente.

MI mosqueo es porque se supone que el código que usaba antes era correcto ¿o no? la noche me confunde....

Última edición por lvfp; 07/10/2009 a las 11:16 Razón: Comentario al código