Fix Guestbook RSS Feed

This commit is contained in:
Evan G. 2024-05-30 12:10:00 -05:00
parent e76610d374
commit 51e63370a4
Signed by: fbievan
GPG Key ID: 55FAB8CB6842F080
1 changed files with 26 additions and 18 deletions

View File

@ -1,18 +1,26 @@
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<?php
header( "Content-type: text/xml");
echo "<?xml version='1.0' encoding='UTF-8' ?>
<rss version='2.0'>
<channel>
<title>Fbi's Epic Guestbook RSS Feed</title>
<link>https://www.w3schools.com</link>
<description>A cool Guestbook made by fbievan</description>
<?php
<description>A cool Guestbook made by fbievan</description>";
$data = json_decode(file_get_contents('test.json'), true);
?>
<?php foreach($data as $post): ?>
$id = 0;
foreach($data as $post) {
$id = $id + 1;
$description = htmlspecialchars($post["message"]);
$title = $post["name"];
$link = "http://testing.fbievan.live/guestbook?link=$id";
echo "
<item>
<title><?php echo $post["name"];?></title>
<description><?php echo htmlspecialchars($post["message"]);?></description>
</item>
<?php endforeach; ?>
<title>$title</title>
<description>$description</description>
<link>$link</link>
</item>";
};
echo "
</channel>
</rss>
</rss>";
?>