moodblog/rss.php
2022-11-25 17:19:26 +02:00

32 lines
1.1 KiB
PHP

<?php
header('Content-Type: application/xml');
include('templates/config.php');
?>
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet href="rss.xsl" type="text/xsl" media="screen"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<atom:link href="<?php echo $root; ?>/rss.php" rel="self" type="application/rss+xml" />
<title><?php echo $short_blog_title; ?></title>
<link><?php echo $root; ?>/rss.php</link>
<description><?php $blog_title; ?></description>
<?php
require "creds.php";
$result = mysqli_query($mysqli, "SELECT ID, Title, Mood, Song, UNIX_TIMESTAMP(Time), Message FROM articles ORDER BY ID DESC");
while($res = mysqli_fetch_array($result)) {
echo " <item>\n";
echo " <title>".$res['Title']."</title>\n";
echo " <pubDate>".date('r', $res["UNIX_TIMESTAMP(Time)"])."</pubDate>\n";
echo " <link>".$root."/#".$res['ID']."</link>\n";
echo " <guid>".$root."/#".$res['ID']."</guid>\n";
echo " <description>\n";
echo " current mood: ".$res['Mood']." - current tunes: ".$res['Song'];
echo "\n </description>\n";
echo " </item>\n";
}
?>
</channel>
</rss>