Ver Mensaje Individual
  #3 (permalink)  
Antiguo 07/03/2012, 10:37
AlexPawno
 
Fecha de Ingreso: marzo-2012
Ubicación: España
Mensajes: 32
Antigüedad: 12 años, 2 meses
Puntos: 2
Respuesta: Poner un feed en mi web con CMS propio

Eleazan, ya lo he mirado, pero cuando pongo eso en mi index.php:

[spoiler]
Cita:
<?php
header("Content-Type: application/rss+xml; charset=utf-8");
?>

<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>¡MeMeMes! ¡Hechate unas risas!</title>
<link>http://www.mememes.com.ar</link>
<description>Tu p&aacute;gina de vi&ntilde;etas</description>

<?php
include ('conexiones/conexion.php');
//hacemos las consultas
$result = mysql_query('SELECT * FROM noticias ORDER BY id_noticia DESC', $connect);
$totalregistros=mysql_num_rows($result);
if ($totalregistros == 0){
echo "No hay ningún registro. Puede haber sido un error. Lo solucionaremos en cuanto podamos. Gracias.";
exit;
}
$registros=1;
$pagina=$_GET['pag'];
if (!$pagina) {
$inicio = 0;
$pagina = 1;
}
else {
$inicio = ($pagina - 1) * $registros;
}
$totalregistros = mysql_num_rows($result);
$result = mysql_query("SELECT * FROM noticias ORDER BY fecha DESC LIMIT $inicio, $registros");
$total_paginas = ceil($totalregistros / $registros);

// Calculamos $fin y luego $enlace_fin para despues saber el tamaño de enlaces a mostrar
$j=10;
for ($fin=1; $fin<$j ;$fin+=1){
for ($j=10; $j<$pagina; $j+=10)
{}}
$enlace_fin = $fin - $pagina;

// Calculamos el boton para avanzar a la pagina siguiente
$j=10;
for ($sigpag=1; $sigpag<$j ;$sigpag+=10){
for ($j=10; $j<$pagina; $j+=10)
{}}

// Calculamos el boton para retroceder a la pagina anterior
$j=21;
for ($antpag=0; $antpag<=$j-20;$antpag+=1){
for ($j=10; $j<$pagina; $j+=10)
{}}

// Calculamos el numero en el cual nos paramos para empezar a paginar
$j=11;
for ($ini=0; $ini<=$j-10;$ini+=1){
for ($j=10; $j<$pagina; $j+=10)
{}}

$result2=mysql_query("SELECT * FROM comentarios WHERE id='$id'",$connect);
$totalcomentarios=mysql_num_rows($result2);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>¡MeMeMes! ¡Hechate unas risas!</title>
<link rel="stylesheet" type="text/css" href="estilos/style.css" media="screen" />
<link rel="stylesheet" type="text/css" href="../estilos/formularios.css" media="screen" />
</head>
<body>
<div id="wrap">
<div id="header">
<h1><a href="http://mememes.com.ar">MeMeMes</a></h1>
<h2>¡Hechate unas risas!</h2>
</div>

<div id="menu">
<a href="index.php">&Uacute;ltimos </a>|
<a href="aleatorios.php">Aletorios </a>|
<a href="memes.php">MeMes </a>
</div>

<div id="contenedor" class="left">

<?php
//Recogemos las consultas en un array y las mostramos
while($row=mysql_fetch_array($result))
{
$result2=mysql_query("SELECT * FROM comentarios where id='".$row[id_noticia]."'",$connect);
$totalcomentarios=mysql_num_rows($result2);
echo '<h2><a href="ver.php?id_noticia='.$row[id_noticia].'">'.$row[titulo].'</a></h2>';
echo '<span>Autor:&nbsp;'.$row[autor].'&nbsp; '.$row[fecha].'</span><br><br><br>';
echo '<a href="ver.php?id_noticia='.$row[id_noticia].'"><img src="comics/'.$row[foto].'" /></a><br><br><br><br>';
}
mysql_free_result($result)

?>
</div>
<div id="menuright">
<?php include('menu.php');?><br />
</div>

<div style="clear: both;"> </div>

<div style="clear: both;" >
<?php
if($pagina>1) {
echo "<a href='index.php?pag=".($pagina-1)."'>« Anterior</a> ";
}
if($pagina>10) {
echo " <a href='index.php?pag=".($antpag)."'>«</a>";?> <?
}


for ($i=$ini; $i<=$enlace_fin+$pagina and $i<=$total_paginas; $i++){
if ($i == $pagina){?>
<? echo "<b>".$i."</b> ";}
else {
echo "<a href='index.php?pag=$i'>$i</a> "; }
}
if($pagina < $total_paginas) {
echo " <a href='index.php?pag=".($pagina+1)."'>Siguiente</a>";
}
if($ini <= $total_paginas) {
echo " <a href='index.php?pag=".($sigpag)."'> »»</a>";
}
?>
</div>

<div id="footer"><a href="http://mememes.com.ar"> MeMeMes &copy;</a> || Dise&ntilde;ado por Alex Alarcón</div>
</div>
</body>
</html>

</channel>
</rss>
[/spoiler]

Me sale un error en esta linea:

<?xml version="1.0" encoding="utf-8"?>

Como lo soluciono??