26 lines
No EOL
1 KiB
PHP
26 lines
No EOL
1 KiB
PHP
<?php
|
|
|
|
header('Content-Type: text/xml');
|
|
|
|
echo '<rss version="2.0"><channel>';
|
|
echo '<title>isopod.cool blog comments</title>';
|
|
echo '<description>Every comment posted on my blog in chronological order.</description>';
|
|
echo '<language>en-us</language>';
|
|
echo '<link>https://isopod.cool/blog/comment/</link>';
|
|
echo '<generator>My crappy PHP code</generator>';
|
|
|
|
$postlist = json_decode(file_get_contents("posts.json"));
|
|
$totaloutput = "";
|
|
foreach($postlist as $post) {
|
|
$output = "";
|
|
$date = date("D, d M Y H:m:s", $post->date) . " GMT";
|
|
$name = $post->name;
|
|
$message = $post->message;
|
|
$entry = $post->entry;
|
|
|
|
$output = $output."Comment from ".$name." on ".$entry.":<br><br>".$message."<br><br>";
|
|
$totaloutput = "<item><title>Comment on " . $entry . " from " . $name . "</title><link>https://isopod.cool/blog/posts/" . $entry . "/</link><pubDate>" . $date . "</pubDate><description>".htmlentities($output)."</description><guid isPermaLink='false'>" . $entry . $post->date . $name . "</guid></item>".$totaloutput;
|
|
}
|
|
|
|
echo $totaloutput;
|
|
echo "</channel></rss>"; |