RSS feed
Hej EksperterJeg har et problem med at få det her til at virker.
Den vil ikke vise noget, og der kommer fejl i valider
$sql = 'SELECT * FROM vare ORDER BY id DESC';
$query = $pdo->prepare($sql);
$query->execute();
$rs_post = $query->fetchAll();
// The XML structure
$data = '<?xml version="1.0" encoding="ISO-8859-1" ?>';
$data .= '<rss version="2.0">';
$data .= '<channel>';
foreach ($rs_post as $row) {
$data .= '<item>';
$date .= '<title>'.$row['vare'].'</title>';
$date .= '<link>'.$row['vare'].'</link>';
$date .= '<description>'.$row['tekst'].'</description>';
$date .= '<image>';
$date .= '<url>'.$row['vare'].'</url>';
$date .= '<link>'.$row['vare'].'</link>';
$date .= '</image>';
$data .= '</item>';
}
$date .= '</channel>';
$date .= '</rss>';
header('Content-Type: application/rss+xml');
echo $data;
Fejlene
This feed does not validate.
line 1, column 78: item must contain either title or description (10 occurrences) [help]
<?xml version="1.0" encoding="ISO-8859-1" ?><rss version="2.0"><channel><ite ...
^
line 1, column 195: XML parsing error: <unknown>:1:202: no element found [help]
... ></item><item></item><item></item><item></item>
^
In addition, interoperability with the widest range of feed readers could be improved by implementing the following recommendation.
line 1, column 78: item should contain a guid element (10 occurrences) [help]
<?xml version="1.0" encoding="ISO-8859-1" ?><rss version="2.0"><channel><ite ...
^
Source: http://www.test.flueopskrifter.dk/rss/rss1.php
<?xml version="1.0" encoding="ISO-8859-1" ?><rss version="2.0"><channel><item></item><item></item><item></item><item></item><item></item><item></item><item></item><item></item><item></item><item></item>
Med venlig hilsen
Morten